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

Friday, March 30, 2012

how can i convert binary(8) to datetime?

HI! :shocked:
I tried to convert 0x01C3F0F5012D36E0, binary(8) to datetime
But
How can I do that?
thanks for allwhat does 0x01C3F0F5012D36E0 repesent in datetime as ?|||You can't convert it, it is bigger than the largest possible datetime:DECLARE @.dMax DATETIME

SET @.dMax = '9999-12-31 23:59:59.997'

SELECT Cast(@.dMax AS VARBINARY(8)), 0x01C3F0F5012D36E0-PatP

How can i convert binary(16) to Integer or numeric?

HI!!!:shocked:

Im trying to convert 0x00085180F0A2D511B69600508BE96424 to Integer or numeric format.

I just tried, At to many forms and combinations of that query
Help me !!!

SELECT CAST(CAST(CAST("field name " AS nvarchar) AS varbinary) AS float)

select cast(cast("field name " as varbinary)as integer)

select convert(int," field name") from FILE

select convert(varchar," field name") from FILE

The only answer that I have is
-1947638748 or or

And if I try with to many rows of the field at the same format,
It Answer me the same: -1947638748 for all the rows.

Thank`s for allcreate table #t1(f1 binary(16))

select *
from #t1

insert into #t1 values(convert(binary(16),'0x00085180F0A2D511B6960 0508BE96424'))

select convert(integer, f1)
from #t1

--The result is 1093813301. I dont see -1947638748

drop table #t1|||:D THANK YOU!!!, forXLDB

Just one more question please

Whats the reason for the space in the middle of the expression?

Before convert

Original Expresin
'0x00085180F0A2D511B69600508BE96424'

Convert expresin
'0x00085180F0A2D511B6960 0508BE96424'|||thank you...|||Sorry, but the actual answer is MUCH larger! You can't express that VARBINARY value as an integer, or even as a NUMERIC(38) which is the largest SQL Server will allow. The following code shows what I mean:DECLARE
@.b VARBINARY(16) -- binary image to convert
, @.i INT -- Which byte we're working on
, @.m FLOAT -- Multiplier for this byte
, @.a FLOAT -- Accumulator

SET @.b = 0x00085180F0A2D511B69600508BE96424
SELECT @.i = DataLength(@.b), @.m = 1, @.a = 0 -- Start with lowest order byte

WHILE 0 < @.i -- While bytes left to process
BEGIN
-- SELECT @.a, @.m, @.i, SubString(@.b, @.i, 1) -- Show your work
SELECT @.a = @.a + (@.m * CAST(SubString(@.b, @.i, 1) AS INT))
SELECT @.m = 256 * @.m, @.i = @.i - 1 -- Prepare for next byte
END

SELECT @.m -- Show results-PatP|||Thanks Pat Phelan

I like that explication step by step.
It really please me.sql

Friday, March 9, 2012

How are pictures stored in a SQL database ??

Are they actually broken down into a binary record entry, or is there a jpg
file sitting out there somewhere that I haven't yet found ?I believe that they are stored as a binary blob in the record's entry,
not as a file elsewhere.
R.
WANNABE wrote:
> Are they actually broken down into a binary record entry, or is there a jpg
> file sitting out there somewhere that I haven't yet found ?|||What needs to be done to that binary blob to display a picture on a web
site?
================================================<slaught@.vault13.co.uk> wrote in message
news:1169046978.563378.93060@.11g2000cwr.googlegroups.com...
>I believe that they are stored as a binary blob in the record's entry,
> not as a file elsewhere.
> R.
> WANNABE wrote:
>> Are they actually broken down into a binary record entry, or is there a
>> jpg
>> file sitting out there somewhere that I haven't yet found ?
>|||WANNABE wrote:
> Are they actually broken down into a binary record entry, or is there a jpg
> file sitting out there somewhere that I haven't yet found ?
>
http://databases.aspfaq.com/database/should-i-store-images-in-the-database-or-the-filesystem.html
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thank you for the suggestion. This database is a production canned database
application, and I am assuming that there is no way to modify their product
to store pictures in a different way. So, with the understanding that I
know less then I don't know, Is this product only used in the development
realm, or can it be implemented into a database system which is already
storing pictures in blobs? :-) lol thanks..
=============================================="Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45AE450B.7030409@.realsqlguy.com...
> WANNABE wrote:
>> Are they actually broken down into a binary record entry, or is there a
>> jpg file sitting out there somewhere that I haven't yet found ?
> http://databases.aspfaq.com/database/should-i-store-images-in-the-database-or-the-filesystem.html
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Please take a look at this article : "HOW TO: Read and Write BLOB Data by
Using ADO.NET Through ASP.NET": http://support.microsoft.com/kb/326502
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

How are pictures stored in a SQL database ??

Are they actually broken down into a binary record entry, or is there a jpg
file sitting out there somewhere that I haven't yet found ?
I believe that they are stored as a binary blob in the record's entry,
not as a file elsewhere.
R.
WANNABE wrote:

> Are they actually broken down into a binary record entry, or is there a jpg
> file sitting out there somewhere that I haven't yet found ?
|||What needs to be done to that binary blob to display a picture on a web
site?
================================================
<slaught@.vault13.co.uk> wrote in message
news:1169046978.563378.93060@.11g2000cwr.googlegrou ps.com...
>I believe that they are stored as a binary blob in the record's entry,
> not as a file elsewhere.
> R.
> WANNABE wrote:
>
|||WANNABE wrote:
> Are they actually broken down into a binary record entry, or is there a jpg
> file sitting out there somewhere that I haven't yet found ?
>
http://databases.aspfaq.com/database/should-i-store-images-in-the-database-or-the-filesystem.html
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||Please take a look at this article : "HOW TO: Read and Write BLOB Data by
Using ADO.NET Through ASP.NET": http://support.microsoft.com/kb/326502
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

How are pictures stored in a SQL database ??

Are they actually broken down into a binary record entry, or is there a jpg
file sitting out there somewhere that I haven't yet found ?I believe that they are stored as a binary blob in the record's entry,
not as a file elsewhere.
R.
WANNABE wrote:

> Are they actually broken down into a binary record entry, or is there a jp
g
> file sitting out there somewhere that I haven't yet found ?|||What needs to be done to that binary blob to display a picture on a web
site?
========================================
========
<slaught@.vault13.co.uk> wrote in message
news:1169046978.563378.93060@.11g2000cwr.googlegroups.com...
>I believe that they are stored as a binary blob in the record's entry,
> not as a file elsewhere.
> R.
> WANNABE wrote:
>
>|||WANNABE wrote:
> Are they actually broken down into a binary record entry, or is there a jp
g
> file sitting out there somewhere that I haven't yet found ?
>
http://databases.aspfaq.com/databas...filesystem.html
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thank you for the suggestion. This database is a production canned database
application, and I am assuming that there is no way to modify their product
to store pictures in a different way. So, with the understanding that I
know less then I don't know, Is this product only used in the development
realm, or can it be implemented into a database system which is already
storing pictures in blobs? :-) lol thanks..
========================================
======
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:45AE450B.7030409@.realsqlguy.com...
> WANNABE wrote:
> http://databases.aspfaq.com/databas...filesystem.html
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Please take a look at this article : "HOW TO: Read and Write BLOB Data by
Using ADO.NET Through ASP.NET": http://support.microsoft.com/kb/326502
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com