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
 Defining Parameters

Author  Topic 

sirmilt
Starting Member

49 Posts

Posted - 2012-10-08 : 21:11:19
I'm pretty new in using SQL Srver with Visual Basic and the setuo of parameters in a stored procedure.

Somewhere in the past I saw some examples that I think don't tell me the whole story. For instance this parameter was shown:

@Authors nvarchar(60) = a,

I understand that the =a is a default value and the string example I show ends up inserting an a in the field the legitametely should be blank.

My concern is that i can find no documentation indicating the intent of the entry. Can anyone point me in the right direction?

Milt

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-08 : 22:23:44
if you want blank as default value it should be

@Authors nvarchar(60) = '',


if you want NULL as value make it

@Authors nvarchar(60) = NULL


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2012-10-09 : 01:33:36
On SQL Server Books Online - type declare variable and there is documentation answering your question

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

sirmilt
Starting Member

49 Posts

Posted - 2012-10-09 : 11:22:32
Thanks for the replies. The difference between '' and NULL had me a little confused but the ling provided clarified it for me, I have set my defaults to ''.

Milt
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-09 : 21:30:53
quote:
Originally posted by sirmilt

Thanks for the replies. The difference between '' and NULL had me a little confused but the ling provided clarified it for me, I have set my defaults to ''.

Milt


'' is stored as a value in table whereas NULL is stored as a bit internally representing unknown value condition

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -