Re: The identifier is too long in SQL 2000

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Louis Davidson (dr_dontspamme_sql_at_hotmail.com)
Date: 01/31/05


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
> 


Relevant Pages

  • Re: Sending parameters to xp_smtp_sendmail
    ... Tibor Karaszi, SQL Server MVP ... > How can you pass dynamic info into this proc? ... > declare @@xx varchar ... > This one has me stummped I also tryed the 'N' before the single quotes and a ...
    (microsoft.public.sqlserver.programming)
  • [NT] Microsoft SQL Server 2000 OpenDataSource Buffer Overflow
    ... Microsoft's database server SQL Server 2000 has a remotely exploitable ... Please see the "Fix Information" section for more details. ... attacker in an exploit of the overflow will run uninhibited. ... declare @saved_return_address nvarchar ...
    (Securiteam)
  • Re: Timing out????
    ... I didn't know the column name from tbDateDiff. ... Vyas, MVP ... and means something different to SQL Server. ... > DECLARE @IPResetCount BIGINT ...
    (microsoft.public.sqlserver.programming)
  • Re: Assertion: SQL Server 2000 cant issue a SOAP call
    ... > middle tier) and not in SQL Server. ... > the SOAP endpoint. ... > sp_OA* family of system stored procedures to invoke this COM component. ... > DECLARE @object INT ...
    (microsoft.public.sqlserver.programming)
  • Re: 17805 Starting up Java App server, with SQL Server 2000 Backend
    ... network issue although you would expect a network issue to be more random. ... declare @P1 int ... On another machine running SQL Server 2000 Standard on Win2K advanced, ...
    (microsoft.public.sqlserver.clients)