Hi
Am a newbie in sql server pls help me to sort this issue
Am having a table
create table table1
(
id int primary key,
dob date
)
with some values inserted
insert into table1 values(1,'1990-12-12')
insert into table1 values(2,'1991-10-10')
and i have created a SP which accept dob and gives the result.
create proc sp1 @d date
as
select * from table1 where dob=@d
SP works perfectly when execute by command and passing the date value but when i execute the same SP with execute SP window in sql server by passing the date value its giving error
This is the corresponding code generated
DECLARE@return_value int
EXEC@return_value = [dbo].[sp1]
@d = 1992-12-12
SELECT'Return Value' = @return_value
GO
and Error is
Msg 102, Level 15, State 1, Line 5Incorrect syntax near '-'.
i understood the issue that i have to passe the value with single quotes.But the same thing will work with datetime without single quotes
So pls help me ,is this is the default mechanism or any error from my side
Waiting for your response..
thanks in advance