472,330 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,330 software developers and data experts.

How to compare Binary and Int colns

I need to compare and update a Binary(8) coln with values from an
Int(4) coln. Could someone please explain how to do this..??

thanks
Sunit

Jul 23 '05 #1
5 5090
sjoshi (sj****@ingr.com) writes:
I need to compare and update a Binary(8) coln with values from an
Int(4) coln. Could someone please explain how to do this..??


No, because I don't know how you want to compare four bytes with eight.
The standard recommendation is to include:

o CREATE TABLE statemens for your table(s)
o INSERT statements with sample data.
o The desired result given the sample data.

That permits people who tackle your problem to post a tested solution.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2

CREATE TABLE [dbo].[COREBaseClass] (
[oid] [uniqueidentifier] NOT NULL ,
[ConditionID] [int] NOT NULL ,
[persistentFlag] [int] NOT NULL ,
[UIDCreator] [uniqueidentifier] NOT NULL ,
[UIDLastModifier] [uniqueidentifier] NOT NULL ,
[DateCreated] [smalldatetime] NOT NULL ,
[DateLastModified] [smalldatetime] NOT NULL ,
[ApprovalStatus] [int] NOT NULL ,
[ApprovalReason] [int] NOT NULL ,
[tsRelations] [int] NOT NULL ,
[ts] [int] NOT NULL
)
CREATE TABLE [dbo].[COREProxy] (
[oid] [uniqueidentifier] NOT NULL ,
[dwProperties] [int] NOT NULL ,
[sourceTimeStamp] [binary] (8) NOT NULL ,
[COREPersistentFlags] [int] NOT NULL ,
[ts] [int] NOT NULL ,
[tsRelations] [int] NOT NULL
)
These are the 2 tables and I need to update COREProxy.sourceTimeStamp
with the value of COREBaseClass.ts wherever they are not the same.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
Sunit Joshi (sj****@ingr.com) writes:
CREATE TABLE [dbo].[COREBaseClass] (
[oid] [uniqueidentifier] NOT NULL ,
[ConditionID] [int] NOT NULL ,
[persistentFlag] [int] NOT NULL ,
[UIDCreator] [uniqueidentifier] NOT NULL ,
[UIDLastModifier] [uniqueidentifier] NOT NULL ,
[DateCreated] [smalldatetime] NOT NULL ,
[DateLastModified] [smalldatetime] NOT NULL ,
[ApprovalStatus] [int] NOT NULL ,
[ApprovalReason] [int] NOT NULL ,
[tsRelations] [int] NOT NULL ,
[ts] [int] NOT NULL
)
CREATE TABLE [dbo].[COREProxy] (
[oid] [uniqueidentifier] NOT NULL ,
[dwProperties] [int] NOT NULL ,
[sourceTimeStamp] [binary] (8) NOT NULL ,
[COREPersistentFlags] [int] NOT NULL ,
[ts] [int] NOT NULL ,
[tsRelations] [int] NOT NULL
)
These are the 2 tables and I need to update COREProxy.sourceTimeStamp
with the value of COREBaseClass.ts wherever they are not the same.
But how? If ts is 4711, what do you want in sourceTimeStamp?

0x126700000000000, 0x0000126700000000 or 0x000000000001267?

If the number is 47114711, do you want:

0xE9D702CE00000000, 0x02CEE9D700000000 or 0x0000000002CEE9D7?

In my previous post, I said:
The standard recommendation is to include:

o CREATE TABLE statemens for your table(s)
o INSERT statements with sample data.
o The desired result given the sample data.

That permits people who tackle your problem to post a tested solution.


I did not say this only for fun. If you cannot give a good specification
to the problem you have, you will either get no solution at all or

You can say things like:

convert(binary(8), ts) or convert(int, sourceTimeStamp)

But whether this gives you the values you are looking for, I can't
say, because I don't know what you are looking for.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #4
I would need 0x126700000000000 as below:

thanks
Sunit
-------------------------------------------------
But how? If ts is 4711, what do you want in sourceTimeStamp?

0x126700000000000, 0x0000126700000000 or 0x000000000001267?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #5
Sunit Joshi (sj****@ingr.com) writes:
I would need 0x126700000000000 as below:
And what about 47114711?

0xE9D702CE00000000, 0x02CEE9D700000000 or 0x0000000002CEE9D7?

And why do you refuse to post:
The standard recommendation is to include:

o INSERT statements with sample data.
o The desired result given the sample data.


If you are not prepared to put any effort into your problem, why do
you expect someone else to do it?

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Davy | last post by:
Hello all, I have two groups of digit data. The data in it may be repeated. Some thing like {5 59 74 17 5 1} and {3 8 25 4}. And real group is...
1
by: TOI DAY | last post by:
Hi All, This is what I want to do. Support I have two file name abc.txt, xyz.txt I did created md5 hash for abc.txt and store it some directory...
1
by: Sunit Joshi | last post by:
Hello I have a situation like this, I have 2 colns in an SQLServer table which are set to following SQLServer data types sTime->Binary (length=8),...
3
by: NathanV | last post by:
I'm trying to compare two byte's. I think I have to use binary operators. How can I tell if two bytes have the same value? Also, I have a...
1
by: Linda | last post by:
Hi, Is there a way to do a "text" (rather than "binary") compareison with the "like" operator, without changing the global "Option Compare"...
3
by: Benny Ng | last post by:
Dear all, The following is the source. The password is encrypted and saved into the Binary in SQL2K. Now I want to create a new page to compare...
6
by: Gwyn | last post by:
If I test "A+" > "A-" then I get true If I test "A+A" > "A-A" then I get false What the hell is going on?! I can only imagine it's down to...
0
by: Michael Jenck | last post by:
Hi All, I have been playing with the codedom and can't get it to output for option compare Binary with a CodeCompileUnit. I have searched the...
6
by: aznimah | last post by:
hi, i'm work on image comparison. i'm using the similarity measurement which i need to: 1) convert the image into the binary form since the...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.