Re: The identifier is too long in SQL 2000
From: Louis Davidson (dr_dontspamme_sql_at_hotmail.com)
Date: 01/31/05
- Next message: Louis Davidson: "Re: Data Type Question"
- Previous message: Louis Davidson: "Re: where clause"
- In reply to: mamun: "The identifier is too long in SQL 2000"
- Next in thread: Paul: "RE: The identifier is too long in SQL 2000"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 31 Jan 2005 11:27:49 -0600
Change (all of) your double quotes to single quotes. Double quoted items
are considered identifiers and as such your entire query is being treated as
a column names:
declare @logId int
set @logId=192968
declare @querystring char(200)
select @querystring ='SELECT logid,substring(username,1,20)
username,logtime,bytesrecvd,substring(target,1,50) filename FROM
ftplogs.dbo.ftplogs where logid = '+ convert(char,@logId)
6.5 wasn't as picky, 2000 is.
-- ---------------------------------------------------------------------------- Louis Davidson - drsql@hotmail.com SQL Server MVP Compass Technology Management - www.compass.net Pro SQL Server 2000 Database Design - http://www.apress.com/book/bookDisplay.html?bID=266 Note: Please reply to the newsgroups only unless you are interested in consulting services. All other replies may be ignored :) "mamun" <mamun_ah@hotmail.com> wrote in message news:1107192052.465530.127100@c13g2000cwb.googlegroups.com... > Hi All, > > I have an SP written in SQL 6.5 and I was trying to run the same in SQL > 2000. I have one line where it is giving me error. > > declare @logId int > set @logId=192968 > declare @querystring char(200) > select @querystring ="SELECT logid,substring(username,1,20) > username,logtime,bytesrecvd,substring(target,1,50) filename FROM > ftplogs.dbo.ftplogs where logid = "+ convert(char,@logId) > > > I get the following error. > > Server: Msg 103, Level 15, State 7, Line 4 > The identifier that starts with 'SELECT logid,substring(username,1,20) > username,logtime,bytesrecvd,substring(target,1,50) filename FROM > ftplogs.dbo.ftplogs where' is too long. Maximum length is 128. > > I do appreciate your help. > Thanks a million in advance. > > Best regards, > > mamun >
- Next message: Louis Davidson: "Re: Data Type Question"
- Previous message: Louis Davidson: "Re: where clause"
- In reply to: mamun: "The identifier is too long in SQL 2000"
- Next in thread: Paul: "RE: The identifier is too long in SQL 2000"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|