Showing posts with label binary. Show all posts
Showing posts with label binary. Show all posts

Wednesday, March 28, 2012

regarding BLOB

Does sql server has the data type similar to BLOB (Binary larger
object)which is available to DB2. BLOB in DB2 can support up to 2 G
(variable-length data )

if it does have, which one offers better functionalities

any advice will be greatly appreciated!causacn@.gmail.com wrote:
> Does sql server has the data type similar to BLOB (Binary larger
> object)which is available to DB2. BLOB in DB2 can support up to 2 G
> (variable-length data )
> if it does have, which one offers better functionalities
> any advice will be greatly appreciated!

Binary and varbinary. How they compare to DB2's blob I don't know.|||Binary and varbinary are "fixed length" in the same sense as char and
varchar. If you want to store a large amount of binary data, you
probably want the "image" type.|||i just checked the sql server docs.
it seems image type is DB2 blobs equivalent|||(causacn@.gmail.com) writes:
> Does sql server has the data type similar to BLOB (Binary larger
> object)which is available to DB2. BLOB in DB2 can support up to 2 G
> (variable-length data )
> if it does have, which one offers better functionalities
> any advice will be greatly appreciated!

The "classic" answer in this regard is the image data type, with its
cousins text and ntext for character data.

But in the new version of SQL Server, SQL 2005, just recently released,
there is a new data type: varbinary(MAX) as well as varchar(MAX) and
nvarchar(MAX). If you are on SQL 2005, you should use the MAX data types,
as they are lot easier to deal with than image/text/ntext.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Monday, February 20, 2012

Reduce string to binary comparison

Is it possible to create a binary comparison from a string? For numbers, you can use this syntax:

Value * (1-ABS(SIGN([Column Name] - [Desired Value))) which will evaluate to one or zero.

For strings, I thought it would be easier. I tried:

Value * ([Column Name]=[Desired Value])

But that does not work. I get an "incorrect syntax near = error. I am looking for a solution that does not rely on the case statement.

Thanks,

AndrewComparison operators return a Boolean data type - TRUE, FALSE, UNKNOWN. As such, you cannot perform arithmetic on them. You are stuck with a CASE statement, or you could use a UDF to do the comparison and return a 1 or 0.

Terri|||Thanks for your response.

Andrew