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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Stored Procedure for date time columns

Author  Topic 

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2007-12-05 : 11:07:17
I have procedure which takes dates in the form of varchar fields, but when I pass the dates as I get an error

ALTER procedure P_REALTYTAX (@DATE1 varchar(20), @DATE2 varchar(20))
as

EXEC dbo.[P_REALTYTAX] ('2007-12-05', '2007-12-05')
EXEC dbo.[P_REALTYTAX] ('11/07/07', '11/07/06')

I get the following error

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '2007'.

Thanks
Sri

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-12-05 : 11:11:41
quote:
Originally posted by scelamko

I have procedure which takes dates in the form of varchar fields, but when I pass the dates as I get an error

ALTER procedure P_REALTYTAX (@DATE1 varchar(20), @DATE2 varchar(20))
as

EXEC dbo.[P_REALTYTAX] '2007-12-05', '2007-12-05'
EXEC dbo.[P_REALTYTAX] '11/07/07', '11/07/06'

I get the following error

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '2007'.

Thanks
Sri




Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-05 : 11:12:44
What Harsh did (if you not already noticed) is to remove the paranthesises.

Only UDF calls need them. SP calls do not.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2007-12-05 : 11:46:49
Thanks Harsh and Peso that helps
Go to Top of Page
   

- Advertisement -