SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Defining Parameters
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sirmilt
Starting Member

USA
49 Posts

Posted - 10/08/2012 :  21:11:19  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 10/08/2012 :  22:23:44  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
2032 Posts

Posted - 10/09/2012 :  01:33:36  Show Profile  Visit jackv's Homepage  Reply with Quote
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

USA
49 Posts

Posted - 10/09/2012 :  11:22:32  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 10/09/2012 :  21:30:53  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000