troubleshooting Question

SQL - error in using a parameter in SQL Stored procedure

Avatar of tommym121
tommym121Flag for Canada asked on
Microsoft SQL Server
5 Comments2 Solutions207 ViewsLast Modified:
CREATE PROCEDURE FindDuplicateRecordIn
      -- Add the parameters for the stored procedure here
      @table nvarchar(256) = ' ',
      @column nvarchar(256) = ' '

      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SELECT * FROM @table GROUP BY @column

When I compile, I have the following error:

Msg 137, Level 15, State 2, Procedure FindDuplicateRecordIn, Line 16
Must declare the variable '@table'.

I am not sure why, @table is pass down as an argument from the store procedure. I change the @table to @table1.  Same error
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros