Hi,
This problem seems to be occurring because you are using SQL 2K. Did you
recently upgrade to SQL 2000 client tools??
It is recommended that single-quotes be used for enclosing any character
string values. This is as per SQL-92 standards. When you use double-quotes
SQL Server thinks that you are specifying an identifier. Try changing all
your double-quotes to single-quotes and then compiling.
By default the Quoted_Identifier is ON when Query Analyzer connects. When
Quoted_Identifier is ON SQL Server follows SQL-92 rules. As per this --
1. Single quotation marks should be used to enclose character strings.
2. Double quotation marks should be used only to delimit identifiers.
(Equivalent to using Square Brackets)
You can get further info by looking up "Character Data" and "identifiers" in
SQL Server Books Online.
HTH,
Ayyappan
-----Original Message-----
From: Friedberg, Carolyn [mailto:cfriedberg@c...]
Sent: Tuesday, July 09, 2002 8:47 AM
To: sql language
Subject: [sql_language] Stored proc that will not work
I have a stored procedure that worked until I added two date fields to one
of the underlying tables. Now I get the message "Server: Msg 1038, Level
15, State 3, Line 4
Cannot use empty object or column names. Use a single space if necessary."
This sproc is one of many that are being used in a similar fashion.
I can execute portions of the sproc from the query analyzer after changing
the quotes to apostrophes.
Things I have done:
1. Made sure there are no empty lines at the top of the sproc.
2. Removed the added fields and references to them.
3. Deleted the sproc and created from the Query Analyzer.
In other words, I still have trouble even after reverting it back to its
original state. I do not know just where to go with the trouble shooting.
Here is a portion:
CREATE PROCEDURE CEEmpRegionAssign
@SelectString varchar(2500) = Null,
@Restrictions varchar(100) = Null,
@Current varchar(10) = Null,
@Date1 varchar(12) = Null,
@Date2 varchar(12) = Null
AS
Declare @SQLStrInternal1 as varchar(2500)
Declare @SQLContext as varchar(5)
Set @SQLStrInternal1 = null
If @Restrictions = 'AllRegionAssign'
Begin
If @Current = 'Current' --Includes 1099's. Must not be
terminated
Begin
Set @SQLStrInternal1 = 'Select CEER_RegionID as [Region ID],
CEER_RegionName as [Region],
CEER_EffectiveDate as [Effective Date],
CEER_EmpNo as [Emp #],
REPLACE(REPLACE(CONVERT(varchar, CEER_EffectiveDate,
120), "-", ""), "", "") AS [Effective Sort]
FROM CEEmpPermData
INNER JOIN
CEEmpRegionAssignments ON CEER_EmpNo
CEEP_EmpNo
INNER JOIN
CEEmpHistData a ON CEEmpPermData.CEEP_EmpNo
= a.CEEH_EmpNo
Where (CEEH_RehireDate is not null and
CEEH_RehireDate > CEEH_TermDate AND
a.CEEH_EffectiveDate = (Select
Max(CEEH_EffectiveDate) from CEEmpHistData b where a.ceeh_empno
b.ceeh_empno))
Or
( CEEH_RehireDate is not null and
CEEH_TermDate is null AND
a.CEEH_EffectiveDate = (Select
Max(CEEH_EffectiveDate) from CEEmpHistData b where a.ceeh_empno
b.ceeh_empno))
Or
( CEEH_RehireDate is null and CEEH_TermDate
is null AND
a.CEEH_EffectiveDate = (Select
Max(CEEH_EffectiveDate) from CEEmpHistData b where a.ceeh_empno
b.ceeh_empno))
Order by CEER_RegionID,CEEP_LastName,CEEP_FirstName,
CEER_EffectiveDate DESC'
End
End
--- Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
"The information in this email, and in any attachments,
may contain confidential information and is intended
solely for the attention and use of the named addressee(s).
It must not be disclosed to any person without authorization.
If you are not the intended recipient, or a person responsible for
delivering it to the intended recipient, you are not authorized
to, and must not, disclose, copy, distribute, or retain this
message or any part of it."