August 23, 2007 at 7:13 am
I want to put an time stamp on a table that is being used for reporting so that I can easily tell the last time it was filled with data. When I run the following, I get the error below. what am I doing wrong?
TIA
Dean
EXEC
sp_updateextendedproperty
@name
= N'DataUpdated', @value = GETDATE(),
@level0type
= N'Schema', @level0name = dbo,
@level1type
= N'Table', @level1name = GPSReport;
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ')'.
August 23, 2007 at 7:43 am
You cannot use a function in the parameter list of sp_updateextendedproperty. You can get around this by declaring a variable of datetime type, and then using this variable in the exec statement. Something like:
DECLARE @now datetime
set @now = GETDATE()
EXEC sp_updateextendedproperty
@name = N'DataUpdated', @value = @now,
@level0type = N'Schema', @level0name = dbo,
@level1type = N'Table', @level1name = GPSReport;
Regards,
Andras
August 23, 2007 at 7:50 am
Thanks, is this limitation documented somewhere? I did not see anything telling me that i could not do it the way I was trying to.
Dean
August 23, 2007 at 7:54 am
This is actually a limitation of the EXECUTE statement. It can take values and variables only. See ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/bc806b71-cc55-470a-913e-c5f761d5c4b7.htm
Regards,
Andras
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply