troubleshooting Question

Must declare the scalar variable

Avatar of chriswies
chriswies asked on
Microsoft SQL Server
4 Comments1 Solution893 ViewsLast Modified:
I start with stored procedures right now and play a little bit with a piece of code I have right now in my Access 2003 mdb frontend. It is supposed to just delete tmp-Table entries and create them again afterwards depending on a parameter value.

Unfortunately, I get an error:
Msg 137, Level 15, State 2, Line 4
Must declare the scalar variable "@Gemeinde".

But I can't find out why. Didn't I declare that variable??
Chris



set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER procedure [dbo].[sp_CreateTmpKapitelList]
@Gemeinde UNIQUEIDENTIFIER
as
delete from tmp_ExportKapitel
go
INSERT INTO tmp_ExportKapitel (idKapitel, KapitelText, KapitelWord)
                SELECT idKapitel, KapitelText , -1
                FROM tkey_wdKapitel
                WHERE fiDocument =  @Gemeinde
                ORDER BY KapitelSort
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 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 1 Answer and 4 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