473,544 Members | 2,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5148
sjoshi (sj****@ingr.co m) 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****@sommarsk og.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] [uniqueidentifie r] NOT NULL ,
[ConditionID] [int] NOT NULL ,
[persistentFlag] [int] NOT NULL ,
[UIDCreator] [uniqueidentifie r] NOT NULL ,
[UIDLastModifier] [uniqueidentifie r] NOT NULL ,
[DateCreated] [smalldatetime] NOT NULL ,
[DateLastModifie d] [smalldatetime] NOT NULL ,
[ApprovalStatus] [int] NOT NULL ,
[ApprovalReason] [int] NOT NULL ,
[tsRelations] [int] NOT NULL ,
[ts] [int] NOT NULL
)
CREATE TABLE [dbo].[COREProxy] (
[oid] [uniqueidentifie r] NOT NULL ,
[dwProperties] [int] NOT NULL ,
[sourceTimeStamp] [binary] (8) NOT NULL ,
[COREPersistentF lags] [int] NOT NULL ,
[ts] [int] NOT NULL ,
[tsRelations] [int] NOT NULL
)
These are the 2 tables and I need to update COREProxy.sourc eTimeStamp
with the value of COREBaseClass.t s 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.co m) writes:
CREATE TABLE [dbo].[COREBaseClass] (
[oid] [uniqueidentifie r] NOT NULL ,
[ConditionID] [int] NOT NULL ,
[persistentFlag] [int] NOT NULL ,
[UIDCreator] [uniqueidentifie r] NOT NULL ,
[UIDLastModifier] [uniqueidentifie r] NOT NULL ,
[DateCreated] [smalldatetime] NOT NULL ,
[DateLastModifie d] [smalldatetime] NOT NULL ,
[ApprovalStatus] [int] NOT NULL ,
[ApprovalReason] [int] NOT NULL ,
[tsRelations] [int] NOT NULL ,
[ts] [int] NOT NULL
)
CREATE TABLE [dbo].[COREProxy] (
[oid] [uniqueidentifie r] NOT NULL ,
[dwProperties] [int] NOT NULL ,
[sourceTimeStamp] [binary] (8) NOT NULL ,
[COREPersistentF lags] [int] NOT NULL ,
[ts] [int] NOT NULL ,
[tsRelations] [int] NOT NULL
)
These are the 2 tables and I need to update COREProxy.sourc eTimeStamp
with the value of COREBaseClass.t s wherever they are not the same.
But how? If ts is 4711, what do you want in sourceTimeStamp ?

0x1267000000000 00, 0x0000126700000 000 or 0x0000000000012 67?

If the number is 47114711, do you want:

0xE9D702CE00000 000, 0x02CEE9D700000 000 or 0x0000000002CEE 9D7?

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****@sommarsk og.se

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

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

0x1267000000000 00, 0x0000126700000 000 or 0x0000000000012 67?


*** 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.co m) writes:
I would need 0x1267000000000 00 as below:
And what about 47114711?

0xE9D702CE00000 000, 0x02CEE9D700000 000 or 0x0000000002CEE 9D7?

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****@sommarsk og.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
353
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 larger. Each may own thousands of data. I want to write a program to compare the two groups. //------program-------- IF (one data in Group 1 == one data in Group 2) EXIT the program.
1
8607
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 Here is how I create md5 for the abc.txt FileStream file1 = new FileStream(abc.txt, FileMode.Open, FileAccess.Read); MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
1
1898
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), and tTime -> Int (length=4) I need to compare the 2 values and was looking for the best way to do this. Any hints are greatly appreciated. thanks
3
17230
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 function that is returning a byte value. Is there a way to see if the return value isnt null. Thanks!
1
3500
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" setting? I don't want to risk breaking many, many lines of functional code just to get one "like" operation to behave as I wish. I want to check whether a single-character string is (a letter or...
3
3755
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 the existed password and the password that in the database. But I don't know how to used source code to solve it. Can you help me? Urgently! <<<<<<Save Method<<<<<<
6
1958
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 culture... but why? my thread culture setting is "en-GB" What rules are going on here? Does this mean the only way I can ever test strings is to use String.CompareOrdinal ??????
0
1321
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 web and Don't now if it's possible. If it's not possible I just go with CodeSnippetCompileUnit Please email me a copy at: programmer @ jenck . net (remove the extra spaces)
6
4330
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 algorithm that i've use works with binary data for the computation 2) compare the string binary data to get the similarity or dissimilarity result. The problem is, i already done with the image (jpg)...
0
7438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7632
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7392
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5931
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5309
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1850
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
996
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.