Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How to fix 'you must declare table variable @ListNameTable..

 
   Database Help (Home) -> Programming RSS
Next:  getting info from a SQL result  
Author Message
Andy B

External


Since: Feb 13, 2008
Posts: 215



(Msg. 1) Posted: Wed Aug 06, 2008 6:46 am
Post subject: How to fix 'you must declare table variable @ListNameTable' problem
Archived from groups: microsoft>public>sqlserver>programming (more info?)

I have a stored proc (below). What I want to do is take the @ListNameTable
parameter and use the string value as the table name to insert values into.
When I run it with what is below, I end up getting a 'You must declare the
table variable @ListNameTable.' How do I fix this so I can use the variables
value as the table name?

CREATE PROCEDURE OwnerB12.Insert_MailingListMember (

@ListNameTable varchar(100),

@SubscriberName varchar(50),

@SubscriberEmailAddress varchar(100) )


AS

insert into @ListNameTable values (@SubscriberName, @SubscriberEmailAddress,
1);

 >> Stay informed about: How to fix 'you must declare table variable @ListNameTable.. 
Back to top
Login to vote
Andy B

External


Since: Feb 13, 2008
Posts: 215



(Msg. 2) Posted: Wed Aug 06, 2008 8:15 am
Post subject: Re: How to fix 'you must declare table variable @ListNameTable' problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sorry about the double post. My server was having connection issues and this
got double posted...


"Andy B" wrote in message

>I have a stored proc (below). What I want to do is take the @ListNameTable
>parameter and use the string value as the table name to insert values into.
>When I run it with what is below, I end up getting a 'You must declare the
>table variable @ListNameTable.' How do I fix this so I can use the
>variables value as the table name?
>
> CREATE PROCEDURE OwnerB12.Insert_MailingListMember (
>
> @ListNameTable varchar(100),
>
> @SubscriberName varchar(50),
>
> @SubscriberEmailAddress varchar(100) )
>
>
> AS
>
> insert into @ListNameTable values (@SubscriberName,
> @SubscriberEmailAddress, 1);
>
>

 >> Stay informed about: How to fix 'you must declare table variable @ListNameTable.. 
Back to top
Login to vote
Plamen Ratchev

External


Since: Jan 10, 2008
Posts: 1007



(Msg. 3) Posted: Wed Aug 06, 2008 8:19 am
Post subject: Re: How to fix 'you must declare table variable @ListNameTable' problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Back to top
Login to vote
Yuriy Krapivko

External


Since: Feb 17, 2010
Posts: 2



(Msg. 4) Posted: Wed Feb 17, 2010 10:04 am
Post subject: PHP tutorials [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

PHP tutorials
http://phpforms.net/tutorial/tutorial.html





Plamen Ratchev wrote:

Re: How to fix 'you must declare table variable @ListNameTable' problem
06-Aug-08

Dynamic SQL:
http://www.sommarskog.se/dynamic_sql.html#objectnames


Plamen Ratchev
http://www.SQLStudio.com

Previous Posts In This Thread:

On Wednesday, August 06, 2008 6:46 AM
Andy B wrote:

How to fix 'you must declare table variable @ListNameTable' problem
I have a stored proc (below). What I want to do is take the @ListNameTable
parameter and use the string value as the table name to insert values into.
When I run it with what is below, I end up getting a 'You must declare the
table variable @ListNameTable.' How do I fix this so I can use the variables
value as the table name?

CREATE PROCEDURE OwnerB12.Insert_MailingListMember (

@ListNameTable varchar(100),

@SubscriberName varchar(50),

@SubscriberEmailAddress varchar(100) )


AS

insert into @ListNameTable values (@SubscriberName, @SubscriberEmailAddress,
1);

On Wednesday, August 06, 2008 8:15 AM
Andy B wrote:

Sorry about the double post.
Sorry about the double post. My server was having connection issues and this
got double posted...

On Wednesday, August 06, 2008 8:19 AM
Plamen Ratchev wrote:

Re: How to fix 'you must declare table variable @ListNameTable' problem
Dynamic SQL:
http://www.sommarskog.se/dynamic_sql.html#objectnames


Plamen Ratchev
http://www.SQLStudio.com


Submitted via EggHeadCafe - Software Developer Portal of Choice
Adding WCF Service References
http://www.eggheadcafe.com/tutorials/aspnet/a1647f10-9aa4-4b0c-bbd9-df...a9fab8e
 >> Stay informed about: How to fix 'you must declare table variable @ListNameTable.. 
Back to top
Login to vote
Yuriy Krapivko

External


Since: Feb 17, 2010
Posts: 2



(Msg. 5) Posted: Wed Feb 17, 2010 10:05 am
Post subject: PHP Tutorials [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

<a href="http://phpforms.net/tutorial/tutorial.html">PHP Tutorials</a>




Yuriy Krapivko wrote:

PHP tutorials
17-Feb-10

PHP tutorials
http://phpforms.net/tutorial/tutorial.html

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
How to Annotate Images from a database in a web page
http://www.eggheadcafe.com/tutorials/aspnet/0c4c3072-6730-41db-a759-08...4acd999
 >> Stay informed about: How to fix 'you must declare table variable @ListNameTable.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Must declare scalar variable - Hello I'm having serious problems with my procedures. For some reason now that we've moved to sql 2005, it complains about variables being scalar. such as this one CREATE FUNCTION [dbo].[MolTest](@MolID int) RETURNS varchar(500) AS BEGIN DECLARE..

Must declare scalar variable... - I have a query SELECT * FROM .... WHERE (DATEADD(dd, 0, @date) = CONVERT(varchar(10), SR_Service.Date_Entered, 101)) ERROR: Query execution failed for data set 'CurrentYear' Must declare the scalar variable @date. I use this same WHERE statement i...

Must declare the variable @user_action Error - CREATE TRIGGER [folder_test] ON [dbo].[collection1] FOR UPDATE AS IF UPDATE (name) BEGIN DECLARE @id_value int DECLARE @newvalue varchar(64) DECLARE @datenow datetime DECLARE @database varchar(64) DECLARE @irole varchar(64) DECLARE @user_action....

Upon INSERT Code 80040E14 Must declare the variable - Hi, I'm new to SQLServer. That said, I'm trying to insert data using VBScript/DAO with the Sub shown below and get the message "Must declare the variable '@employeeID'. I have a hunch that my SQL syntax requires tweaking. Any suggestions? Thank...

SQLCommand - Must Declare Scalar Variable @Lastname - In the below code I checked that values are coming in. The m_sql string looks like this INSERT INTO dbo.Collaborator (Lastname,Firstname,Degrees,Title,Department,Research) Values(@Lastname,@Firstname,@Degrees,@Title,@Department,@Research) yet I'm..
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]