@sukriti1116
plz correct the error...
In the future when you post your code click "Code" so it will highlight it. It's a bit hard to read it.
Error converting data type varchar to datetime.
It means that your varchar strings can't convert to datetime.
You have to check if your datatime looks like this format:
('yyyy-mm-dd hh:mm:ss' as datetime)
Try to used this:
convert(datetime,@Create,100)
I'm not sure if it's gonna work or not because I can't read your code
LastMitch
Industrious Poster
4,212 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45
Does the error appear when executing the stored procedure or when creating it?
Also try LastMitch's advise to use select convert(datetime, @ENTRYDATE,100) instead of the exec check_returns.... and let us know if the conversion succeeded.
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11
when you are executing the stored procedure, you declare the variables or directly assign values to input of the sproc. Either way copy the date that you are assigning to @ENTRYDATE and replace with it the @ENTRYDATE in the select convert(datetime,@ENTRYDATE,100). You have to also enclose it to single quotes (').
Execute that statement and see if it returns errors.
If you are only executing your stored procedure from inside an app, try to execute it in the server with what would be normal values for your parameters.
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11
If you are getting the conversion error with the select convert(datetime, '2013-02-01',100) statement (or whatever format you are passing date in) , then SQL server can't determine the format of your date and you need to either tell it the format or change the format you are using.
A good way to see what format it is expecting would be to select an existing one or select getdate().
If you can't change the date format you are passing your procedure, then use DATEFORMAT to tell the server what format you are using for your date. Read here for SET DATEFORMAT : http://msdn.microsoft.com/en-us/library/ms189491.aspx
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11
@sukriti1116
can u plz edit my code n also provide me an execute statement so that i may get rid of this problem
adam_k provided you a nice link plus he also explained the issue.
LastMitch
Industrious Poster
4,212 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45