Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CreateParameter

Author  Topic 

AllanSQL
Starting Member

5 Posts

Posted - 2007-11-20 : 12:46:58
Hi There,

Could you help on the follwoing issue?

How can I insert a BSTR NULL to SQL database table?

When I use CreateParameter(..) with

aKey = 8 (adBSTR)
aSize = 0
aVar = "" (BSTR empty string with size = 0)

SQL inserts nChar(4000) into the table.

Thanks,

Allan

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-21 : 16:10:28
Do you use t-sql statement?
Go to Top of Page

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2007-11-21 : 16:28:00
Just don't assign anything to aVar; this leaves it set to NULL by default.
Go to Top of Page

AllanSQL
Starting Member

5 Posts

Posted - 2007-11-28 : 10:31:58
quote:
Originally posted by KenW

Just don't assign anything to aVar; this leaves it set to NULL by default.



Thanks. What about aSize ? I can try it with aSize = 0.

aSize = 0 or 1. Leave aVar not to be assigned.

In both cases it failed to insert the entire column into the DB.


[Microsoft][ODBC SQL Server Driver][SQL Server]Parameterized Query '(@P1 nchar(36),@P2 nchar(11),@P3 int,@P4 int,@P5 int,@P6 nchar(8' expects parameter @P10, which was not supplied. (8178) ] +++

Allan
Go to Top of Page

AllanSQL
Starting Member

5 Posts

Posted - 2007-11-28 : 10:34:45
quote:
Originally posted by rmiao

Do you use t-sql statement?



Yes. I am using T-sql?

Thanks.
Go to Top of Page
   

- Advertisement -