Groups | Blog | Home
all groups > sql server clients > april 2004 >

sql server clients : Stored procedures


Kevin3NF
4/2/2004 1:22:23 PM
exec sp_my_insert 10,'10/02/2002'

Single quotes and the exec are the only difference

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com/NewsGroups.htm

[quoted text, click to view]

Kevin3NF
4/2/2004 1:23:47 PM
Also, you have an extra comma on your procedure def at the end of: @aDate
smalldatetime,


--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com/NewsGroups.htm

[quoted text, click to view]

Aaron Bertrand [MVP]
4/2/2004 2:37:30 PM
client, datawarehouse? Followups set appropriately.

[quoted text, click to view]

sp_My_Insert 10, '20021010'

- single quotes, not # (Access) or " (?)
- YYYYMMDD, the only safe format for SQL Server

[quoted text, click to view]

Datatypes are documented in Books Online. Essentially, datetime covers more
dates and is more precise. I tend to use SMALLDATETIME unless I need
accuracy closer than 1 minute.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Chris
4/2/2004 7:17:10 PM
Hi,

I have a stored procedure and one of the parameters is of format
smalldatetime.
What is the format of the parameter when I call the SP ?

CREATE PROCEDURE sp_My_Insert
@org int,
@aDate smalldatetime,
AS
INSERT INTO MyTable(Org, ADate)
VALUES (@org, @aDate)
GO

How do I call this SP ?

sp_My_Insert 10, "10/10/2002" --> error
sp_My_Insert 10, #10/10/2002# --> error

and, what is the difference with a datetime field ?

thanks
Chris

Chris
4/3/2004 11:40:47 AM
Thanks to you all !

[quoted text, click to view]

AddThis Social Bookmark Button