Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure Execute Statement

Status
Not open for further replies.

HLPCH

IS-IT--Management
Jul 12, 2004
47
US
Could someone tell me why my execute statement gives me an error 'Error converting data type nvarchar to datetime.'

Here's the statement:

execute insert_Contact1_1 'A50824380140',getdate

The first field is a nvarchar data type and second is a date type. Somehow it does not recognize the getdate function. Please help.

Thanks in advance
 
execute insert_Contact1_1 'A5082438014077474',getdate()

When I used Getdate() it gave me another error 'Incorrect syntax near ')'.

Any ideas??

Thanks
 
SQL Server is very picky about datetime fields.

I am not sure what your full code is but you have a couple of options:

1) declare @v_date datetime
set @v_date = getdate()
exec insert_Contact1_1 'A5082438014077474', @v_date

2) convert the parameter to a varchar and pass the value as a varchar and use a convert back to datetime in the procedure.

Regards,
AA
 
thanks. I tried this out and it worked. For some reason it does not like using the Getdate() as one of the parameter values.

Thanks Again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top