[dba-SQLServer] SP works sometimes

Mark A Matte markamatte at hotmail.com
Mon Oct 23 15:37:01 CDT 2006


Hello All,

I have SQL7 and I use query analyzer to loop through set of results...these 
results are actually the criteria part of an SQL statement.  This query 
calls a SP.  My SP is below.  It works...then next time I try to run, I have 
to edit and tweek and finally I end up exactly with the same SP I started 
with...and now it runs.  This does not make any sense to me.  can anyone 
shed some light?

Thanks,

Mark A. Matte

P.S...The errors are below...but I know it works...because I ran it 
yesterday...but had to tweek and edit...but end up with same exact SP but it 
runs?????

CREATE PROCEDURE [Select_Records_1] @ID nvarchar(255)  AS
declare @sql as varchar(1000)
declare @nsql as nchar(3000)
set @sql='insert into tblHaier_ID(case_id,Criteria) SELECT case_id, 
"'+ at ID+'" as Criteria FROM tblCase where creation_date>"07/01/2006" and 
'+ at id
set @nsql=@sql
set nocount on
exec sp_executesql @nsql
set nocount off
*********************
ERRORS

Server: Msg 103, Level 15, State 7, Line 1949556518
The identifier that starts with '(rc_descrlong Like '%haier%' or 
rc_descrlong Like '%higher%' or rc_descrlong Like '%haer%' or rc_descrlong 
Like '%hire%' or rc_d' is too long. Maximum length is 128.
Server: Msg 103, Level 15, State 7, Line 1
The identifier that starts with '(sr_other_brand Like '%haier%' or 
sr_other_brand Like '%higher%' or sr_other_brand Like '%haer%' or 
sr_other_brand Like '%hire%'' is too long. Maximum length is 128.
Server: Msg 103, Level 15, State 7, Line 1
The identifier that starts with '(sr_other_reason Like '%haier%' or 
sr_other_reason Like '%higher%' or sr_other_reason Like '%haer%' or 
sr_other_reason Like '%hi' is too long. Maximum length is 128.
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name '(sr_other_prod Like '%harr%' or sr_other_prod Like 
'%42ep24%')'.
Server: Msg 207, Level 16, State 1, Line 1
Invalid column name '07/01/2006'.
Server: Msg 103, Level 15, State 7, Line 1
The identifier that starts with '(model Like '%haier%' or model Like 
'%higher%' or model Like '%haer%' or model Like '%hire%' or model Like 
'%hair%' or model Lik' is too long. Maximum length is 128.
Server: Msg 103, Level 15, State 7, Line 1
The identifier that starts with '(rc_summary Like '%haier%' or rc_summary 
Like '%higher%' or rc_summary Like '%haer%' or rc_summary Like '%hire%' or 
rc_summary L' is too long. Maximum length is 128.
Server: Msg 103, Level 15, State 7, Line 1
The identifier that starts with '(sr_other_prod Like '%haier%' or 
sr_other_prod Like '%higher%' or sr_other_prod Like '%haer%' or 
sr_other_prod Like '%hire%' or ' is too long. Maximum length is 128.
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name '(sr_other_brand Like '%harr%' or sr_other_brand Like 
'%42ep24%')'.
Server: Msg 207, Level 16, State 1, Line 1
Invalid column name '07/01/2006'.
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name '(sr_other_reason Like '%harr%' or sr_other_reason Like 
'%42ep24%')'.
Server: Msg 207, Level 16, State 1, Line 1
Invalid column name '07/01/2006'.

_________________________________________________________________
Try Search Survival Kits: Fix up your home and better handle your cash with 
Live Search! 
http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmtagline




More information about the dba-SQLServer mailing list