January 1, 2004 at 4:32 am
I am writing a stored procedure
CREATE PROCEDURE Sp_RepHour AS
declare @MaxTime int
SELECT max(cast(REPLACE(Objvar,':','') as int)) From TblBid
GO
I want to assign the result of that sql sentence to @MaxTime . it could be something like this
set @MaxTime='SELECT max(cast(REPLACE(Objvar,':','') as int)) From TblBid'
But it gives me some error becuase the marks in the replace, i don't know to what i should change those markes inside of replace function, is this right?
set @MaxTime='SELECT max(cast(REPLACE(Objvar,\':\',\'\') as int)) From TblBid'
thanks
January 1, 2004 at 5:45 am
SELECT @MaxTime = MAX(CAST(REPLACE(Objvar,':','') As int)) FROM TblBid
- Sachin
Regards,
Sachin Dedhia
January 5, 2004 at 7:07 am
Also:
CREATE PROCEDURE Sp_RepHour
@MaxTime AS INT OUTPUT
AS
SELECT @MaxTime = MAX(CAST(REPLACE(Objvar,':','') As int)) FROM TblBid
GO
And then when calling it:
DECLARE @MaxTime AS INT
EXEC Sp_RepHour @MaxTime = @MaxTime OUTPUT
PRINT @MaxTime
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply