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.
Author |
Topic |
bkbinani
Starting Member
15 Posts |
Posted - 2011-11-26 : 01:19:49
|
Dear Experts,I had created a store procedure to get the date but I failed.My Codes:set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOAlter procedure [dbo].[get_ref_date] (@lcuid uniqueidentifier, @dref_date datetime output)asset @dref_date = (Select ditem_trnDate from dat_itm_detail where uitem_trnid = @lcuid)Return @dref_date Here Uitem_trnid is pkey.The above procdure cudn't be save as stating error about conversiondate.Error"Msg 257, Level 16, State 3, Procedure get_ref_date, Line 11Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query."Please Help me.Thanx in Advance. |
|
james_wells
Yak Posting Veteran
55 Posts |
Posted - 2011-11-26 : 06:18:45
|
RETURN expects an integer to be returnednormally used to return a status value one way to return the date valuedeclare @temprable table(dref_date datetime) insert into @temprableexecute [dbo].[get_ref_date] @lcuidremove the dref_date from the stored procedureset ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOAlter procedure [dbo].[get_ref_date] (@lcuid uniqueidentifier)asSelect ditem_trnDate from dat_itm_detail where uitem_trnid = @lcuid |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
bkbinani
Starting Member
15 Posts |
Posted - 2011-11-28 : 00:21:56
|
Thanx for Sharing such important thing.It was unknow to me about RETURN value of a SP.Nice Hope to c u again |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 03:23:52
|
quote: Originally posted by bkbinani Thanx for Sharing such important thing.It was unknow to me about RETURN value of a SP.Nice Hope to c u again
for your case you should be using OUTPUT parameter as suggested in posted link------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|