December 26, 2007 at 9:59 am
I created the following Stored Procedure however when I try to Exec and pass a value for the table name it says Invalid Object Name '@CheckTable'
Msg 208, Level 16, State 1, Procedure Invalid object name '@CheckTable'.
Exec sp_vcGetStop 'CHECKS_DEC2007','3300000001'
CREATE PROCEDURE [dbo].[sp_vcGetStop]
@CheckTablevarchar(15),
@Sequence numeric(10,0)
AS
BEGIN
SELECT CUID As 'Rt', WorkType
FROM [@CheckTable]
WHERE Sequence = @Sequence
END
December 26, 2007 at 11:51 am
It doesn't work like that. Google "dynamic sql" and sp_executesql or look it up in BOL.
December 26, 2007 at 12:34 pm
Thanks issue resolved.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy