Showing posts with label saving. Show all posts
Showing posts with label saving. Show all posts

Saturday, February 25, 2012

Blob in Tsql

Hi,
I am writing a tsql in which i am saving contents of one table into another using "insert into.. select".
But it doesnt work for Blobs.. what should i do??
can anyone help me on this.
Thank You.Refer to UPDATETEXT/WRITETEXT/READTEXT under BOL.|||ya.. i have tried with writetext and readtext but am not able to get it right with it.

i have to read a blob from a table and insert it into another table.

the code is as follows:
/**************
DECLARE @.ptrval binary(16)
DECLARE @.destval binary(16)

SELECT @.ptrval = TEXTPTR(icon_file)
FROM subject_master where subject_id=1

READTEXT subject_master.icon_file @.ptrval 1 2000

select @.destval = TEXTPTR(icon_file)
FROM subject_master_ver where subject_id=1

Writetext subject_master_ver.icon_file @.destVal @.ptrval
************/
but it doesnt work...
can u help me out with this...

Thank You.

Originally posted by Satya
Refer to UPDATETEXT/WRITETEXT/READTEXT under BOL.|||Have you tried using DTS in this case, if its a regular process then schedule the job to do so.

HTH
Originally posted by swatisk
ya.. i have tried with writetext and readtext but am not able to get it right with it.

i have to read a blob from a table and insert it into another table.

the code is as follows:
/**************
DECLARE @.ptrval binary(16)
DECLARE @.destval binary(16)

SELECT @.ptrval = TEXTPTR(icon_file)
FROM subject_master where subject_id=1

READTEXT subject_master.icon_file @.ptrval 1 2000

select @.destval = TEXTPTR(icon_file)
FROM subject_master_ver where subject_id=1

Writetext subject_master_ver.icon_file @.destVal @.ptrval
************/
but it doesnt work...
can u help me out with this...

Thank You.|||its not a regular process... it is triggered by the user of the system.
i have not used DTS at all.
by the way what is the problem with my code??
the way i am using writetext,readtext is fine??
i am not able to find any example for writing a blob(image) into a blob(image) of a table... not available in the books online.
pls help.

Thank You.

Originally posted by Satya
Have you tried using DTS in this case, if its a regular process then schedule the job to do so.

HTH|||Try this

http://www.motobit.com/help/ScptUtl/sa307.htm

Friday, February 10, 2012

bit field

HI,

while saving in bit field sometimes it is saved as true or false. sometimes it is saved as 0 or 1.

how to make it true or false when i needed.

if i set default value to 0 will it save 1 or 0 always.

with default 0 i need to store truee or false. how it is possible this way.

thanks

venp

Hi,

the bit data type always stores either 0 (which is false) or 1 (which is true). A default value is used if no value is explictly passed through.

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

HI jens,

sometimes it stores the word True or False(bit field) thats why i'm confused.

i need to know when it stores 0 or False and 1 or True.

it is confusing me a lot.

venp

|||

Hi,

no the BIT data type is a INT type with the constraint of holding only 0 or 1. The true or false is a client presentation you are seeing, Excel will for example use this presentation for the boolean type.

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

Hi,

00

TrueFalse
01TrueFalse
02TrueFalse
210TrueFalse
220TrueFalse
250TrueFalse
03FalseFalse

the above values i copied from table. true ,false fields are bit datatype.

venp--

|||Where did you copied the output from ?|||

from sqlserver table .i opened the table in sql server and copied.

venp--

|||Do the same query in the query window of SSMS and you will see that this is just a question of presentation. SSMS will display BIT as true / false but SQL Server stores 1/0.

-Jens.|||

you are right

venp--