Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error (urgent!!)

Author  Topic 

1sabine8
Posting Yak Master

130 Posts

Posted - 2008-09-29 : 05:31:11
Hi,
I'm writing a stored procedure. In a part of the code, i'm declaring a variable that will contain the SQL statement.
Here it is:
DECLARE @SQL varchar(8000)

SET @SQL =
"INSERT INTO #AllLoyalCustomers(ContactId)
SELECT distinct dbo.FilteredContact.contactid
FROM dbo.FilteredContact INNER JOIN dbo.FilteredNew_dineintakeawaycommentcard ON dbo.FilteredContact.contactid = dbo.FilteredNew_dineintakeawaycommentcard.new_contactid
WHERE dbo.FilteredNew_dineintakeawaycommentcard.new_restaurantname IN '"& @RestaurantName1 &"'"

i'm getting the followin error:
Msg 103, Level 15, State 4, Procedure AllLoyalCustomers, Line 49
The identifier that starts with 'INSERT INTO #AllLoyalCustomers(ContactId)
SELECT distinct dbo.FilteredContact.contactid
FROM dbo.FilteredContact INNER JOIN db' is too long. Maximum length is 128.

How can i solve it?
It's urgent!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-29 : 05:32:16
have provided solution here. dont cross post plaese

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=111339
Go to Top of Page
   

- Advertisement -