Showing posts with label following. Show all posts
Showing posts with label following. Show all posts

Wednesday, March 21, 2012

QUOTENAME Problem

I have following four cases


Code Snippet

1) select QUOTENAME (QUOTENAME ('ABCD', ''''),'''' )
Output: '''ABCD'''

Code Snippet

2) select QUOTENAME (QUOTENAME ('ABCD', ''''),']' )
Output: ['ABCD']

Code Snippet

3) select QUOTENAME (QUOTENAME ('ABCD', ''''),'"' )
Output: "'ABCD'"

Code Snippet

4) select QUOTENAME (QUOTENAME ('ABCD', '"'),'"' )
Output: """ABCD"""

Now my questions is second & three outputs are fine, but what happen to the first & forth one. I want single quote twice around string(in first case) and double quote twice around string(in forth case) but it gives me three single/double quotes, WHY ?

Gurpreet S. Gill

There was a recent post here:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1537605&SiteID=1

In which I noted this behavior in Louis Davidson's example. This behavior also appears in books online so it is intended and you will need to account for it in your coding.

|||

Sorry, but I can not see what your concern is. Let me try to explain 1 and 4.

1 - select QUOTENAME (QUOTENAME ('ABCD', ''''),'''' )

The first call to the function will produce 'ABCD', correct?. Ther second call has to wrap the string 'ABCD' between aposthopes (including the existing aposthropes), so in order to wrap an aposthrope between apostropes you have to double the inner apostrophe. The result of the second call will be '''ABCD''', where the inner apostrophes were double. Let us put some spaces to differentiate them.

' ''ABCD'' '

2 - select QUOTENAME (QUOTENAME ('ABCD', '"'),'"' )

The same as in number 1, but this time both wrap will be between the double qoute ("). The inner double quote should be double and wrap them between double quote.

" ""ABCD"" "

We need to scape the character inside the string and we do it doubling the character being used, in those cases apostrophe and double quote. Let us see what happend if we decide to do the same with ']'.

select quotename(quotename('ABCD', ']'), ']')

Result:

[[ABCD]]]

The behavior with ']' is different compare with apostrophe or double quote, just the most right is doubled.

Hope my english does not get you dizzy.

AMB

Quoted-Identifyer

Hi
Since short time I am experiencing the following problem when testing a
stored procedure.
Error on Insert since the following set options are not set properly:
QUOTED_IDENTIFYER
Sorry, that I do not have an exact error message, since I am working on
a german server, and I only translated the message by myself.
The error occured without changing the procedure or the data. It
suddenly appeared, then disappeared and then appeared again...
regards
StephanzDo any of your statements use "" around column names or aliases or values?
If a column name has spaces or is a reserved word, use [brackets] as opposed
to "double quotes" -- and strings should be delimited using 'single quotes'
rather than "double quotes".
"Stephan Zaubzer" <stephan.zaubzer@.schendl.at> wrote in message
news:uStQuCoyFHA.3588@.tk2msftngp13.phx.gbl...
> Hi
> Since short time I am experiencing the following problem when testing a
> stored procedure.
> Error on Insert since the following set options are not set properly:
> QUOTED_IDENTIFYER
> Sorry, that I do not have an exact error message, since I am working on a
> german server, and I only translated the message by myself.
> The error occured without changing the procedure or the data. It suddenly
> appeared, then disappeared and then appeared again...
> regards
> Stephanz|||In all my Procedures there is no " (Double Quote).
I already checked this. No column name has any space or uses reserved
words... and all my strings are sourrounded with single quotes. That's
why I contacted this news group, because this behaviour seems to be kind
of strange.
Last w the procedure worked fine! This w, suddenly I got the error
and I put a "SET QUOTED_IDENTIFYER ON" right above the insert statement.
Then it worked. Today it stopped working and I moved the "SET
QUOTED_IDENTIFYER ON" statement right to the beginning of the stored
procedure and then it worked again. But I didn't change any column names
in the database nor did I change the stored procedure. That all
sometimes makes me even believe that software can be indeterministic
allthough I know that it isn't...
regards
Stephan
Aaron Bertrand [SQL Server MVP] wrote:
> Do any of your statements use "" around column names or aliases or values?
> If a column name has spaces or is a reserved word, use [brackets] as opposed
> to "double quotes" -- and strings should be delimited using 'single quotes
'
> rather than "double quotes".
>
>
> "Stephan Zaubzer" <stephan.zaubzer@.schendl.at> wrote in message
> news:uStQuCoyFHA.3588@.tk2msftngp13.phx.gbl...
>
>
>|||debug the procedure with print statments and the profiler,
I always put this at the beginning an end of my sProcs
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
...do stuff
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET NOCOUNT OFF
GO
"Aaron Bertrand [SQL Server MVP]" wrote:

> Do any of your statements use "" around column names or aliases or values?
> If a column name has spaces or is a reserved word, use [brackets] as opposed
> to "double quotes" -- and strings should be delimited using 'single quotes
'
> rather than "double quotes".
>
>
> "Stephan Zaubzer" <stephan.zaubzer@.schendl.at> wrote in message
> news:uStQuCoyFHA.3588@.tk2msftngp13.phx.gbl...
>
>|||I traced down the problem a little bit:
The problem first arised when changing to a new developement server
which is hosted on a virtual test machine rather than on my old crappy
laptop ;-)
When creating tables, stored procedures and so on I never cared about
the QUOTED-IDENTIFYER options and I now had a look in the old version of
the database on my laptop and there for each stored procedure the
QUOTED-IDENTIFYER option was set to ON. Now (with exactly the same
create scripts for the stored procedures) for each procedure the server
sets this option to OFF. This is my problem now. How does the server
determine wheter to set or unset the QUOTED-IDENTIFYER option when
creating stored procedures.
btw... The error on the insert statement happened even though I did not
have any double quotes or similar constructs. SQL server requires that
when performing inserts, deletes, updates and creates on tables with
indexed views QUOTED-IDENTIFYERS must be set to ON. Otherwise those
opererations will fail...
Stephan Zaubzer wrote:
> In all my Procedures there is no " (Double Quote).
> I already checked this. No column name has any space or uses reserved
> words... and all my strings are sourrounded with single quotes. That's
> why I contacted this news group, because this behaviour seems to be kind
> of strange.
> Last w the procedure worked fine! This w, suddenly I got the error
> and I put a "SET QUOTED_IDENTIFYER ON" right above the insert statement.
> Then it worked. Today it stopped working and I moved the "SET
> QUOTED_IDENTIFYER ON" statement right to the beginning of the stored
> procedure and then it worked again. But I didn't change any column names
> in the database nor did I change the stored procedure. That all
> sometimes makes me even believe that software can be indeterministic
> allthough I know that it isn't...
> regards
> Stephan
> Aaron Bertrand [SQL Server MVP] wrote:
>|||> sets this option to OFF. This is my problem now. How does the server
> determine wheter to set or unset the QUOTED-IDENTIFYER option when
> creating stored procedures.
The server doesn't. The connection settings in effect for the dbms
connection used to edit the procedure are used (and saved). You determine
these settings by the method (or application) you use to edit the procedure.
You should read the information in BOL under the topic of "create
procedure". There is a detailed explanation of the settings that are
relevant to procedure creation and execution - very important information!

> btw... The error on the insert statement happened even though I did not
> have any double quotes or similar constructs. SQL server requires that
> when performing inserts, deletes, updates and creates on tables with
> indexed views QUOTED-IDENTIFYERS must be set to ON. Otherwise those
> opererations will fail...
Yes - this is (relatively) common knowledge. It helps to provide complete
information when posting in the newsgroups. Had you mentioned that an
indexed view was involved, someone might have identified the actual problem
a bit quicker. As a side note, you should also verify that any triggers
that may be participating in these actions are not contributing to the
problem.sql

'QUOTED_IDENTIFIER' when updating

Hello, I am getting the following message when running a stored proc:
Server: Msg 1934, Level 16, State 1, Procedure SZ_ProcessToCPInvoices, Line
261
UPDATE failed because the following SET options have incorrect settings:
'QUOTED_IDENTIFIER'.
I cannot find any information about this error. This happens with
QUOTED_IDENTIFIER on or off.
The setting is a sticky option, so setting it before execution or inside the proc doesn't change
anything. You have to set this in the connection where you *create* the procedure.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Ric" <Ric@.discussions.microsoft.com> wrote in message
news:13732376-28A5-4352-93CB-619B20137D3D@.microsoft.com...
> Hello, I am getting the following message when running a stored proc:
> Server: Msg 1934, Level 16, State 1, Procedure SZ_ProcessToCPInvoices, Line
> 261
> UPDATE failed because the following SET options have incorrect settings:
> 'QUOTED_IDENTIFIER'.
> I cannot find any information about this error. This happens with
> QUOTED_IDENTIFIER on or off.
>
>

'QUOTED_IDENTIFIER' when updating

Hello, I am getting the following message when running a stored proc:
Server: Msg 1934, Level 16, State 1, Procedure SZ_ProcessToCPInvoices, Line
261
UPDATE failed because the following SET options have incorrect settings:
'QUOTED_IDENTIFIER'.
I cannot find any information about this error. This happens with
QUOTED_IDENTIFIER on or off.The setting is a sticky option, so setting it before execution or inside the
proc doesn't change
anything. You have to set this in the connection where you *create* the proc
edure.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Ric" <Ric@.discussions.microsoft.com> wrote in message
news:13732376-28A5-4352-93CB-619B20137D3D@.microsoft.com...
> Hello, I am getting the following message when running a stored proc:
> Server: Msg 1934, Level 16, State 1, Procedure SZ_ProcessToCPInvoices, Lin
e
> 261
> UPDATE failed because the following SET options have incorrect settings:
> 'QUOTED_IDENTIFIER'.
> I cannot find any information about this error. This happens with
> QUOTED_IDENTIFIER on or off.
>
>

'QUOTED_IDENTIFIER' when updating

Hello, I am getting the following message when running a stored proc:
Server: Msg 1934, Level 16, State 1, Procedure SZ_ProcessToCPInvoices, Line
261
UPDATE failed because the following SET options have incorrect settings:
'QUOTED_IDENTIFIER'.
I cannot find any information about this error. This happens with
QUOTED_IDENTIFIER on or off.The setting is a sticky option, so setting it before execution or inside the proc doesn't change
anything. You have to set this in the connection where you *create* the procedure.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Ric" <Ric@.discussions.microsoft.com> wrote in message
news:13732376-28A5-4352-93CB-619B20137D3D@.microsoft.com...
> Hello, I am getting the following message when running a stored proc:
> Server: Msg 1934, Level 16, State 1, Procedure SZ_ProcessToCPInvoices, Line
> 261
> UPDATE failed because the following SET options have incorrect settings:
> 'QUOTED_IDENTIFIER'.
> I cannot find any information about this error. This happens with
> QUOTED_IDENTIFIER on or off.
>
>

Quoted Identifiers Don't Work with Linked Servers and Update

I believe this is a bug in how update SQL statements are parsed when
executing against a linked server. I execute the following SQL:
update [server].[database].[dbo].[table] set [my column] = 'new value'
Note the space in the column name 'my column'. And I get the following
errors:
Server: Msg 8180, Level 16, State 1, Line 1
Statement(s) could not be prepared.
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'column'.
The syntax of that SQL statement is correct. In fact, I can go to the
linked server and execute it there and it works, like this:
update [table] set [my column] = 'new value'
If I change the schema so the column does not have a space in it, then
execute the following SQL statement from the original server with the server
link, it works:
update [server].[database].[dbo].[table] set [mycolumn] = 'new value'
This to me says that there is a parsing bug because, when performing an
update against a linked server, the quoted identifier for the column is not
respected! Note that this works:
select [my column] from [server].[database].[dbo].[table]
So it appears to be a problem parsing the update statement.
Can anyone shed some light on what is going on? Should I use a support
incident to get this fixed? Or is it something I am doing wrong? Thanks!
-CoreyYou don't say what version of sql server your using so it is hard to say but
there are numerous KB's with related subjects on this. Here is one that
seems to fit.
http://support.microsoft.com/default.aspx?scid=kb;en-us;218995&Product=sql2k
If that is not it then I would take a look at the other hits in the KB that
you can find from here:
http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto
and enter "linked server identifier".
Andrew J. Kelly
SQL Server MVP
"Young, Corey" <Corey@.Youngspot.com> wrote in message
news:ub5tcM2mDHA.2488@.TK2MSFTNGP12.phx.gbl...
> I believe this is a bug in how update SQL statements are parsed when
> executing against a linked server. I execute the following SQL:
> update [server].[database].[dbo].[table] set [my column] = 'new value'
> Note the space in the column name 'my column'. And I get the following
> errors:
> Server: Msg 8180, Level 16, State 1, Line 1
> Statement(s) could not be prepared.
> Server: Msg 170, Level 15, State 1, Line 1
> Line 1: Incorrect syntax near 'column'.
> The syntax of that SQL statement is correct. In fact, I can go to the
> linked server and execute it there and it works, like this:
> update [table] set [my column] = 'new value'
> If I change the schema so the column does not have a space in it, then
> execute the following SQL statement from the original server with the
server
> link, it works:
> update [server].[database].[dbo].[table] set [mycolumn] = 'new value'
> This to me says that there is a parsing bug because, when performing an
> update against a linked server, the quoted identifier for the column is
not
> respected! Note that this works:
> select [my column] from [server].[database].[dbo].[table]
> So it appears to be a problem parsing the update statement.
> Can anyone shed some light on what is going on? Should I use a support
> incident to get this fixed? Or is it something I am doing wrong? Thanks!
> -Corey
>
>|||Thanks for the response! I'm using SQL Server 2000 with Service Pack 3.
The problem happens:
1. Using Query Analyzer
2. In my code, which uses the native SQL Server .NET data provider
I have seen and read a lot of articles and, while they discuss the problem,
and while Microsoft claims they have fixed it in other situations, they have
not fixed it in mine. I would be interested if anyone could reproduce the
problem, or could give me information that would lead to a solution of the
problem. Otherwise I'll be forced to use an MSDN support incident.
-Corey
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23MDPlH$mDHA.2416@.TK2MSFTNGP10.phx.gbl...
> You don't say what version of sql server your using so it is hard to say
but
> there are numerous KB's with related subjects on this. Here is one that
> seems to fit.
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;218995&Product=sql2k
> If that is not it then I would take a look at the other hits in the KB
that
> you can find from here:
> http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto
> and enter "linked server identifier".
>
> --
> Andrew J. Kelly
> SQL Server MVP
>
> "Young, Corey" <Corey@.Youngspot.com> wrote in message
> news:ub5tcM2mDHA.2488@.TK2MSFTNGP12.phx.gbl...
> > I believe this is a bug in how update SQL statements are parsed when
> > executing against a linked server. I execute the following SQL:
> >
> > update [server].[database].[dbo].[table] set [my column] = 'new value'
> >
> > Note the space in the column name 'my column'. And I get the following
> > errors:
> >
> > Server: Msg 8180, Level 16, State 1, Line 1
> > Statement(s) could not be prepared.
> > Server: Msg 170, Level 15, State 1, Line 1
> > Line 1: Incorrect syntax near 'column'.
> >
> > The syntax of that SQL statement is correct. In fact, I can go to the
> > linked server and execute it there and it works, like this:
> >
> > update [table] set [my column] = 'new value'
> >
> > If I change the schema so the column does not have a space in it, then
> > execute the following SQL statement from the original server with the
> server
> > link, it works:
> >
> > update [server].[database].[dbo].[table] set [mycolumn] = 'new value'
> >
> > This to me says that there is a parsing bug because, when performing an
> > update against a linked server, the quoted identifier for the column is
> not
> > respected! Note that this works:
> >
> > select [my column] from [server].[database].[dbo].[table]
> >
> > So it appears to be a problem parsing the update statement.
> >
> > Can anyone shed some light on what is going on? Should I use a support
> > incident to get this fixed? Or is it something I am doing wrong?
Thanks!
> >
> > -Corey
> >
> >
> >
>|||OK, it is best to post that extra info up front so that we don't have to
assume anything. I will post this on the private ng and see if anyone else
can confirm this. By the way does it work if you use double quotes instead
of [] ?
--
Andrew J. Kelly
SQL Server MVP
"Young, Corey" <Corey@.Youngspot.com> wrote in message
news:eW8lOl$mDHA.2772@.TK2MSFTNGP10.phx.gbl...
> Thanks for the response! I'm using SQL Server 2000 with Service Pack 3.
> The problem happens:
> 1. Using Query Analyzer
> 2. In my code, which uses the native SQL Server .NET data provider
> I have seen and read a lot of articles and, while they discuss the
problem,
> and while Microsoft claims they have fixed it in other situations, they
have
> not fixed it in mine. I would be interested if anyone could reproduce the
> problem, or could give me information that would lead to a solution of the
> problem. Otherwise I'll be forced to use an MSDN support incident.
> -Corey
>
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:%23MDPlH$mDHA.2416@.TK2MSFTNGP10.phx.gbl...
> > You don't say what version of sql server your using so it is hard to say
> but
> > there are numerous KB's with related subjects on this. Here is one that
> > seems to fit.
> >
> >
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;218995&Product=sql2k
> >
> > If that is not it then I would take a look at the other hits in the KB
> that
> > you can find from here:
> > http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto
> >
> > and enter "linked server identifier".
> >
> >
> >
> > --
> >
> > Andrew J. Kelly
> > SQL Server MVP
> >
> >
> > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > news:ub5tcM2mDHA.2488@.TK2MSFTNGP12.phx.gbl...
> > > I believe this is a bug in how update SQL statements are parsed when
> > > executing against a linked server. I execute the following SQL:
> > >
> > > update [server].[database].[dbo].[table] set [my column] = 'new value'
> > >
> > > Note the space in the column name 'my column'. And I get the
following
> > > errors:
> > >
> > > Server: Msg 8180, Level 16, State 1, Line 1
> > > Statement(s) could not be prepared.
> > > Server: Msg 170, Level 15, State 1, Line 1
> > > Line 1: Incorrect syntax near 'column'.
> > >
> > > The syntax of that SQL statement is correct. In fact, I can go to the
> > > linked server and execute it there and it works, like this:
> > >
> > > update [table] set [my column] = 'new value'
> > >
> > > If I change the schema so the column does not have a space in it, then
> > > execute the following SQL statement from the original server with the
> > server
> > > link, it works:
> > >
> > > update [server].[database].[dbo].[table] set [mycolumn] = 'new value'
> > >
> > > This to me says that there is a parsing bug because, when performing
an
> > > update against a linked server, the quoted identifier for the column
is
> > not
> > > respected! Note that this works:
> > >
> > > select [my column] from [server].[database].[dbo].[table]
> > >
> > > So it appears to be a problem parsing the update statement.
> > >
> > > Can anyone shed some light on what is going on? Should I use a
support
> > > incident to get this fixed? Or is it something I am doing wrong?
> Thanks!
> > >
> > > -Corey
> > >
> > >
> > >
> >
> >
>|||Thanks!
The behavior is the same using either double-quotes or brackets.
-Corey
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:ucOjyfBnDHA.2592@.TK2MSFTNGP10.phx.gbl...
> OK, it is best to post that extra info up front so that we don't have to
> assume anything. I will post this on the private ng and see if anyone
else
> can confirm this. By the way does it work if you use double quotes
instead
> of [] ?
> --
> Andrew J. Kelly
> SQL Server MVP
>
> "Young, Corey" <Corey@.Youngspot.com> wrote in message
> news:eW8lOl$mDHA.2772@.TK2MSFTNGP10.phx.gbl...
> > Thanks for the response! I'm using SQL Server 2000 with Service Pack 3.
> > The problem happens:
> >
> > 1. Using Query Analyzer
> > 2. In my code, which uses the native SQL Server .NET data provider
> >
> > I have seen and read a lot of articles and, while they discuss the
> problem,
> > and while Microsoft claims they have fixed it in other situations, they
> have
> > not fixed it in mine. I would be interested if anyone could reproduce
the
> > problem, or could give me information that would lead to a solution of
the
> > problem. Otherwise I'll be forced to use an MSDN support incident.
> >
> > -Corey
> >
> >
> > "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> > news:%23MDPlH$mDHA.2416@.TK2MSFTNGP10.phx.gbl...
> > > You don't say what version of sql server your using so it is hard to
say
> > but
> > > there are numerous KB's with related subjects on this. Here is one
that
> > > seems to fit.
> > >
> > >
> >
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;218995&Product=sql2k
> > >
> > > If that is not it then I would take a look at the other hits in the KB
> > that
> > > you can find from here:
> > > http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto
> > >
> > > and enter "linked server identifier".
> > >
> > >
> > >
> > > --
> > >
> > > Andrew J. Kelly
> > > SQL Server MVP
> > >
> > >
> > > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > > news:ub5tcM2mDHA.2488@.TK2MSFTNGP12.phx.gbl...
> > > > I believe this is a bug in how update SQL statements are parsed when
> > > > executing against a linked server. I execute the following SQL:
> > > >
> > > > update [server].[database].[dbo].[table] set [my column] = 'new
value'
> > > >
> > > > Note the space in the column name 'my column'. And I get the
> following
> > > > errors:
> > > >
> > > > Server: Msg 8180, Level 16, State 1, Line 1
> > > > Statement(s) could not be prepared.
> > > > Server: Msg 170, Level 15, State 1, Line 1
> > > > Line 1: Incorrect syntax near 'column'.
> > > >
> > > > The syntax of that SQL statement is correct. In fact, I can go to
the
> > > > linked server and execute it there and it works, like this:
> > > >
> > > > update [table] set [my column] = 'new value'
> > > >
> > > > If I change the schema so the column does not have a space in it,
then
> > > > execute the following SQL statement from the original server with
the
> > > server
> > > > link, it works:
> > > >
> > > > update [server].[database].[dbo].[table] set [mycolumn] = 'new
value'
> > > >
> > > > This to me says that there is a parsing bug because, when performing
> an
> > > > update against a linked server, the quoted identifier for the column
> is
> > > not
> > > > respected! Note that this works:
> > > >
> > > > select [my column] from [server].[database].[dbo].[table]
> > > >
> > > > So it appears to be a problem parsing the update statement.
> > > >
> > > > Can anyone shed some light on what is going on? Should I use a
> support
> > > > incident to get this fixed? Or is it something I am doing wrong?
> > Thanks!
> > > >
> > > > -Corey
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||Corey,
Here is a reply I got from another MVP and although I don't like the answer
I guess it makes sense as to what is going on.
> My understanding is that, this is a known limitation(?) of OLE DB provider
> for SQL Server. By default, SQL Server OLE DB provider supports two
> interfaces IRowsetUpdate & IRowsetChange whose properties determine
whether
> the underlying rowset can be updated or not. Delimited identifiers with
> certain characters (~ , - ,! ,{ ,% ,} ,^ ,' ,& ,. ,( ,\ , ) ,` ,space) can
> set these property bits to false thereby making the underlying rowset
> non-updateable. This causes any update/insert/delete queries including
> 4-part naming & pass-through against these datasets to fail.
> A workaround may be to avoid direct 4-part naming and pass thru queries
and
> try to do the update directly on the server, say using sp_executeSQL like:
> EXEC server.database.dbo.sp_ExecuteSQL N'
> UPDATE [table] SET [my column] = ''new value'''
>
Since I never use spaces I can't say I have run across this before. Another
option would be to use a stored proc that lives in the other server and call
it to do the update. Good luck. If you still aren't satisfied you can give
MS PSS a call.
http://support.microsoft.com/default.aspx?scid=fh;EN-US;sql SQL Support
http://www.mssqlserver.com/faq/general-pss.asp MS PSS
--
Andrew J. Kelly
SQL Server MVP
"Young, Corey" <Corey@.Youngspot.com> wrote in message
news:uzPNp%23BnDHA.1284@.TK2MSFTNGP09.phx.gbl...
> Thanks!
> The behavior is the same using either double-quotes or brackets.
> -Corey
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:ucOjyfBnDHA.2592@.TK2MSFTNGP10.phx.gbl...
> > OK, it is best to post that extra info up front so that we don't have to
> > assume anything. I will post this on the private ng and see if anyone
> else
> > can confirm this. By the way does it work if you use double quotes
> instead
> > of [] ?
> >
> > --
> >
> > Andrew J. Kelly
> > SQL Server MVP
> >
> >
> > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > news:eW8lOl$mDHA.2772@.TK2MSFTNGP10.phx.gbl...
> > > Thanks for the response! I'm using SQL Server 2000 with Service Pack
3.
> > > The problem happens:
> > >
> > > 1. Using Query Analyzer
> > > 2. In my code, which uses the native SQL Server .NET data provider
> > >
> > > I have seen and read a lot of articles and, while they discuss the
> > problem,
> > > and while Microsoft claims they have fixed it in other situations,
they
> > have
> > > not fixed it in mine. I would be interested if anyone could reproduce
> the
> > > problem, or could give me information that would lead to a solution of
> the
> > > problem. Otherwise I'll be forced to use an MSDN support incident.
> > >
> > > -Corey
> > >
> > >
> > > "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> > > news:%23MDPlH$mDHA.2416@.TK2MSFTNGP10.phx.gbl...
> > > > You don't say what version of sql server your using so it is hard to
> say
> > > but
> > > > there are numerous KB's with related subjects on this. Here is one
> that
> > > > seems to fit.
> > > >
> > > >
> > >
> >
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;218995&Product=sql2k
> > > >
> > > > If that is not it then I would take a look at the other hits in the
KB
> > > that
> > > > you can find from here:
> > > > http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto
> > > >
> > > > and enter "linked server identifier".
> > > >
> > > >
> > > >
> > > > --
> > > >
> > > > Andrew J. Kelly
> > > > SQL Server MVP
> > > >
> > > >
> > > > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > > > news:ub5tcM2mDHA.2488@.TK2MSFTNGP12.phx.gbl...
> > > > > I believe this is a bug in how update SQL statements are parsed
when
> > > > > executing against a linked server. I execute the following SQL:
> > > > >
> > > > > update [server].[database].[dbo].[table] set [my column] = 'new
> value'
> > > > >
> > > > > Note the space in the column name 'my column'. And I get the
> > following
> > > > > errors:
> > > > >
> > > > > Server: Msg 8180, Level 16, State 1, Line 1
> > > > > Statement(s) could not be prepared.
> > > > > Server: Msg 170, Level 15, State 1, Line 1
> > > > > Line 1: Incorrect syntax near 'column'.
> > > > >
> > > > > The syntax of that SQL statement is correct. In fact, I can go to
> the
> > > > > linked server and execute it there and it works, like this:
> > > > >
> > > > > update [table] set [my column] = 'new value'
> > > > >
> > > > > If I change the schema so the column does not have a space in it,
> then
> > > > > execute the following SQL statement from the original server with
> the
> > > > server
> > > > > link, it works:
> > > > >
> > > > > update [server].[database].[dbo].[table] set [mycolumn] = 'new
> value'
> > > > >
> > > > > This to me says that there is a parsing bug because, when
performing
> > an
> > > > > update against a linked server, the quoted identifier for the
column
> > is
> > > > not
> > > > > respected! Note that this works:
> > > > >
> > > > > select [my column] from [server].[database].[dbo].[table]
> > > > >
> > > > > So it appears to be a problem parsing the update statement.
> > > > >
> > > > > Can anyone shed some light on what is going on? Should I use a
> > support
> > > > > incident to get this fixed? Or is it something I am doing wrong?
> > > Thanks!
> > > > >
> > > > > -Corey
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||Thanks for the help!
I have not seen 4-part naming to be a problem as I am able to do inserts and
updates to tables on the linked server when the table and column names don't
require bracketing or quoting.
The table and column names are highly dynamic, so having a stored procedure
on the linked server is probably not a good option for me. However, I had
not thought of the sp_executesql option, which I will try. What I had
planned on doing (until you came up with the sp_executesql option) was to
name my columns and tables such that they do not have spaces in them, but
rather have the '_' character in them, and then just changing the '_'
character to a space prior to display to the user. I'll try your idea
first.
Will there be any performance consequences vs. normal inserts and updates as
a result of using sp_executesql in the way you have described?
Again, thanks a lot for the help! I really appreciate it.
-Corey
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:Oo7xj4OnDHA.424@.TK2MSFTNGP10.phx.gbl...
> Corey,
> Here is a reply I got from another MVP and although I don't like the
answer
> I guess it makes sense as to what is going on.
> > My understanding is that, this is a known limitation(?) of OLE DB
provider
> > for SQL Server. By default, SQL Server OLE DB provider supports two
> > interfaces IRowsetUpdate & IRowsetChange whose properties determine
> whether
> > the underlying rowset can be updated or not. Delimited identifiers with
> > certain characters (~ , - ,! ,{ ,% ,} ,^ ,' ,& ,. ,( ,\ , ) ,` ,space)
can
> > set these property bits to false thereby making the underlying rowset
> > non-updateable. This causes any update/insert/delete queries including
> > 4-part naming & pass-through against these datasets to fail.
> >
> > A workaround may be to avoid direct 4-part naming and pass thru queries
> and
> > try to do the update directly on the server, say using sp_executeSQL
like:
> >
> > EXEC server.database.dbo.sp_ExecuteSQL N'
> > UPDATE [table] SET [my column] = ''new value'''
> >
>
> Since I never use spaces I can't say I have run across this before.
Another
> option would be to use a stored proc that lives in the other server and
call
> it to do the update. Good luck. If you still aren't satisfied you can
give
> MS PSS a call.
>
> http://support.microsoft.com/default.aspx?scid=fh;EN-US;sql SQL Support
> http://www.mssqlserver.com/faq/general-pss.asp MS PSS
> --
> Andrew J. Kelly
> SQL Server MVP
>
> "Young, Corey" <Corey@.Youngspot.com> wrote in message
> news:uzPNp%23BnDHA.1284@.TK2MSFTNGP09.phx.gbl...
> > Thanks!
> >
> > The behavior is the same using either double-quotes or brackets.
> >
> > -Corey
> >
> > "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> > news:ucOjyfBnDHA.2592@.TK2MSFTNGP10.phx.gbl...
> > > OK, it is best to post that extra info up front so that we don't have
to
> > > assume anything. I will post this on the private ng and see if anyone
> > else
> > > can confirm this. By the way does it work if you use double quotes
> > instead
> > > of [] ?
> > >
> > > --
> > >
> > > Andrew J. Kelly
> > > SQL Server MVP
> > >
> > >
> > > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > > news:eW8lOl$mDHA.2772@.TK2MSFTNGP10.phx.gbl...
> > > > Thanks for the response! I'm using SQL Server 2000 with Service
Pack
> 3.
> > > > The problem happens:
> > > >
> > > > 1. Using Query Analyzer
> > > > 2. In my code, which uses the native SQL Server .NET data provider
> > > >
> > > > I have seen and read a lot of articles and, while they discuss the
> > > problem,
> > > > and while Microsoft claims they have fixed it in other situations,
> they
> > > have
> > > > not fixed it in mine. I would be interested if anyone could
reproduce
> > the
> > > > problem, or could give me information that would lead to a solution
of
> > the
> > > > problem. Otherwise I'll be forced to use an MSDN support incident.
> > > >
> > > > -Corey
> > > >
> > > >
> > > > "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> > > > news:%23MDPlH$mDHA.2416@.TK2MSFTNGP10.phx.gbl...
> > > > > You don't say what version of sql server your using so it is hard
to
> > say
> > > > but
> > > > > there are numerous KB's with related subjects on this. Here is
one
> > that
> > > > > seems to fit.
> > > > >
> > > > >
> > > >
> > >
> >
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;218995&Product=sql2k
> > > > >
> > > > > If that is not it then I would take a look at the other hits in
the
> KB
> > > > that
> > > > > you can find from here:
> > > > > http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto
> > > > >
> > > > > and enter "linked server identifier".
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Andrew J. Kelly
> > > > > SQL Server MVP
> > > > >
> > > > >
> > > > > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > > > > news:ub5tcM2mDHA.2488@.TK2MSFTNGP12.phx.gbl...
> > > > > > I believe this is a bug in how update SQL statements are parsed
> when
> > > > > > executing against a linked server. I execute the following SQL:
> > > > > >
> > > > > > update [server].[database].[dbo].[table] set [my column] = 'new
> > value'
> > > > > >
> > > > > > Note the space in the column name 'my column'. And I get the
> > > following
> > > > > > errors:
> > > > > >
> > > > > > Server: Msg 8180, Level 16, State 1, Line 1
> > > > > > Statement(s) could not be prepared.
> > > > > > Server: Msg 170, Level 15, State 1, Line 1
> > > > > > Line 1: Incorrect syntax near 'column'.
> > > > > >
> > > > > > The syntax of that SQL statement is correct. In fact, I can go
to
> > the
> > > > > > linked server and execute it there and it works, like this:
> > > > > >
> > > > > > update [table] set [my column] = 'new value'
> > > > > >
> > > > > > If I change the schema so the column does not have a space in
it,
> > then
> > > > > > execute the following SQL statement from the original server
with
> > the
> > > > > server
> > > > > > link, it works:
> > > > > >
> > > > > > update [server].[database].[dbo].[table] set [mycolumn] = 'new
> > value'
> > > > > >
> > > > > > This to me says that there is a parsing bug because, when
> performing
> > > an
> > > > > > update against a linked server, the quoted identifier for the
> column
> > > is
> > > > > not
> > > > > > respected! Note that this works:
> > > > > >
> > > > > > select [my column] from [server].[database].[dbo].[table]
> > > > > >
> > > > > > So it appears to be a problem parsing the update statement.
> > > > > >
> > > > > > Can anyone shed some light on what is going on? Should I use a
> > > support
> > > > > > incident to get this fixed? Or is it something I am doing
wrong?
> > > > Thanks!
> > > > > >
> > > > > > -Corey
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||sp_executesql can be just as effective as adhoc sql (or more so) if you can
properly parameterize the changing values. If you are calling multiple
tables or columns you will still be able to cache the plan and reuse it the
next time you call a similar update.
--
Andrew J. Kelly
SQL Server MVP
"Young, Corey" <Corey@.Youngspot.com> wrote in message
news:eD820LSnDHA.424@.TK2MSFTNGP10.phx.gbl...
> Thanks for the help!
> I have not seen 4-part naming to be a problem as I am able to do inserts
and
> updates to tables on the linked server when the table and column names
don't
> require bracketing or quoting.
> The table and column names are highly dynamic, so having a stored
procedure
> on the linked server is probably not a good option for me. However, I had
> not thought of the sp_executesql option, which I will try. What I had
> planned on doing (until you came up with the sp_executesql option) was to
> name my columns and tables such that they do not have spaces in them, but
> rather have the '_' character in them, and then just changing the '_'
> character to a space prior to display to the user. I'll try your idea
> first.
> Will there be any performance consequences vs. normal inserts and updates
as
> a result of using sp_executesql in the way you have described?
> Again, thanks a lot for the help! I really appreciate it.
> -Corey
>
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:Oo7xj4OnDHA.424@.TK2MSFTNGP10.phx.gbl...
> > Corey,
> >
> > Here is a reply I got from another MVP and although I don't like the
> answer
> > I guess it makes sense as to what is going on.
> >
> > > My understanding is that, this is a known limitation(?) of OLE DB
> provider
> > > for SQL Server. By default, SQL Server OLE DB provider supports two
> > > interfaces IRowsetUpdate & IRowsetChange whose properties determine
> > whether
> > > the underlying rowset can be updated or not. Delimited identifiers
with
> > > certain characters (~ , - ,! ,{ ,% ,} ,^ ,' ,& ,. ,( ,\ , ) ,` ,space)
> can
> > > set these property bits to false thereby making the underlying rowset
> > > non-updateable. This causes any update/insert/delete queries including
> > > 4-part naming & pass-through against these datasets to fail.
> > >
> > > A workaround may be to avoid direct 4-part naming and pass thru
queries
> > and
> > > try to do the update directly on the server, say using sp_executeSQL
> like:
> > >
> > > EXEC server.database.dbo.sp_ExecuteSQL N'
> > > UPDATE [table] SET [my column] = ''new value'''
> > >
> >
> >
> > Since I never use spaces I can't say I have run across this before.
> Another
> > option would be to use a stored proc that lives in the other server and
> call
> > it to do the update. Good luck. If you still aren't satisfied you can
> give
> > MS PSS a call.
> >
> >
> > http://support.microsoft.com/default.aspx?scid=fh;EN-US;sql SQL
Support
> > http://www.mssqlserver.com/faq/general-pss.asp MS PSS
> >
> > --
> >
> > Andrew J. Kelly
> > SQL Server MVP
> >
> >
> > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > news:uzPNp%23BnDHA.1284@.TK2MSFTNGP09.phx.gbl...
> > > Thanks!
> > >
> > > The behavior is the same using either double-quotes or brackets.
> > >
> > > -Corey
> > >
> > > "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> > > news:ucOjyfBnDHA.2592@.TK2MSFTNGP10.phx.gbl...
> > > > OK, it is best to post that extra info up front so that we don't
have
> to
> > > > assume anything. I will post this on the private ng and see if
anyone
> > > else
> > > > can confirm this. By the way does it work if you use double quotes
> > > instead
> > > > of [] ?
> > > >
> > > > --
> > > >
> > > > Andrew J. Kelly
> > > > SQL Server MVP
> > > >
> > > >
> > > > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > > > news:eW8lOl$mDHA.2772@.TK2MSFTNGP10.phx.gbl...
> > > > > Thanks for the response! I'm using SQL Server 2000 with Service
> Pack
> > 3.
> > > > > The problem happens:
> > > > >
> > > > > 1. Using Query Analyzer
> > > > > 2. In my code, which uses the native SQL Server .NET data provider
> > > > >
> > > > > I have seen and read a lot of articles and, while they discuss the
> > > > problem,
> > > > > and while Microsoft claims they have fixed it in other situations,
> > they
> > > > have
> > > > > not fixed it in mine. I would be interested if anyone could
> reproduce
> > > the
> > > > > problem, or could give me information that would lead to a
solution
> of
> > > the
> > > > > problem. Otherwise I'll be forced to use an MSDN support
incident.
> > > > >
> > > > > -Corey
> > > > >
> > > > >
> > > > > "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> > > > > news:%23MDPlH$mDHA.2416@.TK2MSFTNGP10.phx.gbl...
> > > > > > You don't say what version of sql server your using so it is
hard
> to
> > > say
> > > > > but
> > > > > > there are numerous KB's with related subjects on this. Here is
> one
> > > that
> > > > > > seems to fit.
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;218995&Product=sql2k
> > > > > >
> > > > > > If that is not it then I would take a look at the other hits in
> the
> > KB
> > > > > that
> > > > > > you can find from here:
> > > > > > http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto
> > > > > >
> > > > > > and enter "linked server identifier".
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > Andrew J. Kelly
> > > > > > SQL Server MVP
> > > > > >
> > > > > >
> > > > > > "Young, Corey" <Corey@.Youngspot.com> wrote in message
> > > > > > news:ub5tcM2mDHA.2488@.TK2MSFTNGP12.phx.gbl...
> > > > > > > I believe this is a bug in how update SQL statements are
parsed
> > when
> > > > > > > executing against a linked server. I execute the following
SQL:
> > > > > > >
> > > > > > > update [server].[database].[dbo].[table] set [my column] ='new
> > > value'
> > > > > > >
> > > > > > > Note the space in the column name 'my column'. And I get the
> > > > following
> > > > > > > errors:
> > > > > > >
> > > > > > > Server: Msg 8180, Level 16, State 1, Line 1
> > > > > > > Statement(s) could not be prepared.
> > > > > > > Server: Msg 170, Level 15, State 1, Line 1
> > > > > > > Line 1: Incorrect syntax near 'column'.
> > > > > > >
> > > > > > > The syntax of that SQL statement is correct. In fact, I can
go
> to
> > > the
> > > > > > > linked server and execute it there and it works, like this:
> > > > > > >
> > > > > > > update [table] set [my column] = 'new value'
> > > > > > >
> > > > > > > If I change the schema so the column does not have a space in
> it,
> > > then
> > > > > > > execute the following SQL statement from the original server
> with
> > > the
> > > > > > server
> > > > > > > link, it works:
> > > > > > >
> > > > > > > update [server].[database].[dbo].[table] set [mycolumn] = 'new
> > > value'
> > > > > > >
> > > > > > > This to me says that there is a parsing bug because, when
> > performing
> > > > an
> > > > > > > update against a linked server, the quoted identifier for the
> > column
> > > > is
> > > > > > not
> > > > > > > respected! Note that this works:
> > > > > > >
> > > > > > > select [my column] from [server].[database].[dbo].[table]
> > > > > > >
> > > > > > > So it appears to be a problem parsing the update statement.
> > > > > > >
> > > > > > > Can anyone shed some light on what is going on? Should I use
a
> > > > support
> > > > > > > incident to get this fixed? Or is it something I am doing
> wrong?
> > > > > Thanks!
> > > > > > >
> > > > > > > -Corey
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>

Quoted identifiers

SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
I get the following entries in the text log file that the step creates:
Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
[1] Database cdw: Index Rebuild (leaving 5%% free space)...
Rebuilding indexes for table 'Accounts'
Rebuilding indexes for table 'Advisor Names'
Rebuilding indexes for table 'Advisor Rep Nums'
Rebuilding indexes for table 'Asset Master'
Rebuilding indexes for table 'BP Claim Filed'
Rebuilding indexes for table 'Breakpoints'
Rebuilding indexes for table 'BSE Trans Prefixes'
Rebuilding indexes for table 'BSE Trans Prefixes Rev'
Rebuilding indexes for table 'BSE Trans Prefixes Std'
Rebuilding indexes for table 'Core_MM_NFS'
Rebuilding indexes for table 'Core_MM_Pershing'
Rebuilding indexes for table 'Dates'
Rebuilding indexes for table 'Dates_MktOpen'
Rebuilding indexes for table 'DAZL Delete'
Rebuilding indexes for table 'Direct Business Transactions'
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft][ODBC
SQL Server Driver][SQL Server]DBCC failed because the following SET
options have incorrect settings: 'QUOTED_IDENTIFIER'.
Well it would be nice if it didn't say "INCORRECT SETTING" but instead
would say that the setting should be ON, or should be OFF. (Quoted
Identifiers is ON in my database, according to Select
databasepropertyex.)
After reading all about quoted identifiers, I didn't think they were
stored by table -- I thought it was a database-wide property setting.
According to BOL, "When a table is created, the QUOTED IDENTIFIER option
is always stored as ON in the table's meta data even if the option is
set to OFF when the table is created."
SO, why would so many tables successfully get reindexed and then one of
them (was it 'Direct Business Transactions' or the next one in line?)
fail?
This doesn't make sense. What direction does Set Quoted Identifiers
need to be in for the reindex step of the DB maintenance plan to
succeed? I wish the actual DBCC command was displayed somewhere in this
log also, that would make debugging easier.
Thanks for any information.
David WalkerMore than likely you have a computed column or an indexed view. Both require
certain settings that the MP can't handle. Although I believe this was fixed
in SP4. Otherwise you need to do the reindex in your own custom job with
the proper settings set.
--
Andrew J. Kelly SQL MVP
"DWalker" <none@.none.com> wrote in message
news:uWrSsgLMGHA.1532@.TK2MSFTNGP12.phx.gbl...
> SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
> I get the following entries in the text log file that the step creates:
> Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
> [1] Database cdw: Index Rebuild (leaving 5%% free space)...
> Rebuilding indexes for table 'Accounts'
> Rebuilding indexes for table 'Advisor Names'
> Rebuilding indexes for table 'Advisor Rep Nums'
> Rebuilding indexes for table 'Asset Master'
> Rebuilding indexes for table 'BP Claim Filed'
> Rebuilding indexes for table 'Breakpoints'
> Rebuilding indexes for table 'BSE Trans Prefixes'
> Rebuilding indexes for table 'BSE Trans Prefixes Rev'
> Rebuilding indexes for table 'BSE Trans Prefixes Std'
> Rebuilding indexes for table 'Core_MM_NFS'
> Rebuilding indexes for table 'Core_MM_Pershing'
> Rebuilding indexes for table 'Dates'
> Rebuilding indexes for table 'Dates_MktOpen'
> Rebuilding indexes for table 'DAZL Delete'
> Rebuilding indexes for table 'Direct Business Transactions'
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft][ODBC
> SQL Server Driver][SQL Server]DBCC failed because the following SET
> options have incorrect settings: 'QUOTED_IDENTIFIER'.
> Well it would be nice if it didn't say "INCORRECT SETTING" but instead
> would say that the setting should be ON, or should be OFF. (Quoted
> Identifiers is ON in my database, according to Select
> databasepropertyex.)
> After reading all about quoted identifiers, I didn't think they were
> stored by table -- I thought it was a database-wide property setting.
> According to BOL, "When a table is created, the QUOTED IDENTIFIER option
> is always stored as ON in the table's meta data even if the option is
> set to OFF when the table is created."
> SO, why would so many tables successfully get reindexed and then one of
> them (was it 'Direct Business Transactions' or the next one in line?)
> fail?
> This doesn't make sense. What direction does Set Quoted Identifiers
> need to be in for the reindex step of the DB maintenance plan to
> succeed? I wish the actual DBCC command was displayed somewhere in this
> log also, that would make debugging easier.
> Thanks for any information.
> David Walker|||Hi David
Check out http://support.microsoft.com/default.aspx?scid=kb;en-us;902388,
the particular table probably failed because it is the first that has the
index on a computed column.
If not you may want to look at SQL profiler to see exactly what statements
are being sent to the database by the maintenance plan.
John
"DWalker" wrote:
> SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
> I get the following entries in the text log file that the step creates:
> Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
> [1] Database cdw: Index Rebuild (leaving 5%% free space)...
> Rebuilding indexes for table 'Accounts'
> Rebuilding indexes for table 'Advisor Names'
> Rebuilding indexes for table 'Advisor Rep Nums'
> Rebuilding indexes for table 'Asset Master'
> Rebuilding indexes for table 'BP Claim Filed'
> Rebuilding indexes for table 'Breakpoints'
> Rebuilding indexes for table 'BSE Trans Prefixes'
> Rebuilding indexes for table 'BSE Trans Prefixes Rev'
> Rebuilding indexes for table 'BSE Trans Prefixes Std'
> Rebuilding indexes for table 'Core_MM_NFS'
> Rebuilding indexes for table 'Core_MM_Pershing'
> Rebuilding indexes for table 'Dates'
> Rebuilding indexes for table 'Dates_MktOpen'
> Rebuilding indexes for table 'DAZL Delete'
> Rebuilding indexes for table 'Direct Business Transactions'
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft][ODBC
> SQL Server Driver][SQL Server]DBCC failed because the following SET
> options have incorrect settings: 'QUOTED_IDENTIFIER'.
> Well it would be nice if it didn't say "INCORRECT SETTING" but instead
> would say that the setting should be ON, or should be OFF. (Quoted
> Identifiers is ON in my database, according to Select
> databasepropertyex.)
> After reading all about quoted identifiers, I didn't think they were
> stored by table -- I thought it was a database-wide property setting.
> According to BOL, "When a table is created, the QUOTED IDENTIFIER option
> is always stored as ON in the table's meta data even if the option is
> set to OFF when the table is created."
> SO, why would so many tables successfully get reindexed and then one of
> them (was it 'Direct Business Transactions' or the next one in line?)
> fail?
> This doesn't make sense. What direction does Set Quoted Identifiers
> need to be in for the reindex step of the DB maintenance plan to
> succeed? I wish the actual DBCC command was displayed somewhere in this
> log also, that would make debugging easier.
> Thanks for any information.
> David Walker
>|||Thanks to you both. I do have SP4. I'll double-check that table for a
computed column; I created it a long time ago.
David
=?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:
> Hi David
> Check out
> http://support.microsoft.com/default.aspx?scid=kb;en-us;902388, the
> particular table probably failed because it is the first that has the
> index on a computed column.
> If not you may want to look at SQL profiler to see exactly what
> statements are being sent to the database by the maintenance plan.
> John
>|||"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:
> More than likely you have a computed column or an indexed view. Both
> require certain settings that the MP can't handle. Although I believe
> this was fixed in SP4. Otherwise you need to do the reindex in your
> own custom job with the proper settings set.
>
Ah, so the maintenance plan generator can't maintain any table that has
computed coumns? Interesting.
It also was complaining about other settings that required the database to
be in single-user mode. WTF? It tries to run statements that require
single-user mode? Maybe it ought to try to put the database in single-user
mode, or maybe that's not a good idea. The check-marks in the maintenance
plan generator ought to tell you that single-user mode is required.
My conclusion from this is that the maintenace plan generator is not
suitable for use on databases in the real world. Is that the right
conclusion?
Thanks.
David|||"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:
> More than likely you have a computed column or an indexed view. Both
> require certain settings that the MP can't handle. Although I believe
> this was fixed in SP4. Otherwise you need to do the reindex in your
> own custom job with the proper settings set.
>
So yes, the table did have one computed column. The table can't be
maintained with a maintenance plan?
Or the indexes can't ever be rebuilt?
David|||Hi David
You may want to look at the code in:
http://support.microsoft.com/default.aspx?scid=kb;en-us;301292
John
"DWalker" wrote:
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
> news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:
> > More than likely you have a computed column or an indexed view. Both
> > require certain settings that the MP can't handle. Although I believe
> > this was fixed in SP4. Otherwise you need to do the reindex in your
> > own custom job with the proper settings set.
> >
> So yes, the table did have one computed column. The table can't be
> maintained with a maintenance plan?
> Or the indexes can't ever be rebuilt?
> David
>|||=?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:
> Hi David
> Check out
> http://support.microsoft.com/default.aspx?scid=kb;en-us;902388, the
> particular table probably failed because it is the first that has the
> index on a computed column.
> If not you may want to look at SQL profiler to see exactly what
> statements are being sent to the database by the maintenance plan.
> John
>
That article is sure confusing; it says "These statements require that
the QUOTED_IDENTIFIER SET option is set to ON."
It *IS* set to On in my database. Then it goes on to say, I think, that
the command is built wrong by the maintenance wizard. Why it couldn't
have been fixed in SP4 without requiring me to add the -
SupportcomputedColumn parameter is not explained...
I added the -SupportComputedColumn option to the plan step, and it will
probably fix it, but I'm still a bit confused by the wording in the
article.
Tthanks for the pointer though!
David Walker|||> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database.
The database setting is essentially useless since it will be overridden by session setting. And most
API's will set this setting, whether the developer is aware of it or not.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"DWalker" <none@.none.com> wrote in message news:%23ZTTnSYMGHA.1532@.TK2MSFTNGP12.phx.gbl...
> =?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
> news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:
>> Hi David
>> Check out
>> http://support.microsoft.com/default.aspx?scid=kb;en-us;902388, the
>> particular table probably failed because it is the first that has the
>> index on a computed column.
>> If not you may want to look at SQL profiler to see exactly what
>> statements are being sent to the database by the maintenance plan.
>> John
> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database. Then it goes on to say, I think, that
> the command is built wrong by the maintenance wizard. Why it couldn't
> have been fixed in SP4 without requiring me to add the -
> SupportcomputedColumn parameter is not explained...
> I added the -SupportComputedColumn option to the plan step, and it will
> probably fix it, but I'm still a bit confused by the wording in the
> article.
> Tthanks for the pointer though!
> David Walker|||Hi David
You may want to use the send feedback option at the bottom of the article.
John
"DWalker" wrote:
> =?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
> news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:
> > Hi David
> >
> > Check out
> > http://support.microsoft.com/default.aspx?scid=kb;en-us;902388, the
> > particular table probably failed because it is the first that has the
> > index on a computed column.
> >
> > If not you may want to look at SQL profiler to see exactly what
> > statements are being sent to the database by the maintenance plan.
> >
> > John
> >
> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database. Then it goes on to say, I think, that
> the command is built wrong by the maintenance wizard. Why it couldn't
> have been fixed in SP4 without requiring me to add the -
> SupportcomputedColumn parameter is not explained...
> I added the -SupportComputedColumn option to the plan step, and it will
> probably fix it, but I'm still a bit confused by the wording in the
> article.
> Tthanks for the pointer though!
> David Walker
>|||=?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
news:D4BDB694-0A2E-408D-AA7A-562DBEC42515@.microsoft.com:
> Hi David
> You may want to use the send feedback option at the bottom of the
> article.
> John
>
I'll do that.|||"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
in news:OsfT#fYMGHA.3460@.TK2MSFTNGP15.phx.gbl:
>> That article is sure confusing; it says "These statements require
>> that the QUOTED_IDENTIFIER SET option is set to ON."
>> It *IS* set to On in my database.
> The database setting is essentially useless since it will be
> overridden by session setting. And most API's will set this setting,
> whether the developer is aware of it or not.
>
Thanks, Tibor.
Davidsql

Quoted identifiers

SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
I get the following entries in the text log file that the step creates:
Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
[1] Database cdw: Index Rebuild (leaving 5%% free space)...
Rebuilding indexes for table 'Accounts'
Rebuilding indexes for table 'Advisor Names'
Rebuilding indexes for table 'Advisor Rep Nums'
Rebuilding indexes for table 'Asset Master'
Rebuilding indexes for table 'BP Claim Filed'
Rebuilding indexes for table 'Breakpoints'
Rebuilding indexes for table 'BSE Trans Prefixes'
Rebuilding indexes for table 'BSE Trans Prefixes Rev'
Rebuilding indexes for table 'BSE Trans Prefixes Std'
Rebuilding indexes for table 'Core_MM_NFS'
Rebuilding indexes for table 'Core_MM_Pershing'
Rebuilding indexes for table 'Dates'
Rebuilding indexes for table 'Dates_MktOpen'
Rebuilding indexes for table 'DAZL Delete'
Rebuilding indexes for table 'Direct Business Transactions'
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft]&#
91;ODBC
SQL Server Driver][SQL Server]DBCC failed because the following SET
options have incorrect settings: 'QUOTED_IDENTIFIER'.
Well it would be nice if it didn't say "INCORRECT SETTING" but instead
would say that the setting should be ON, or should be OFF. (Quoted
Identifiers is ON in my database, according to Select
databasepropertyex.)
After reading all about quoted identifiers, I didn't think they were
stored by table -- I thought it was a database-wide property setting.
According to BOL, "When a table is created, the QUOTED IDENTIFIER option
is always stored as ON in the table's meta data even if the option is
set to OFF when the table is created."
SO, why would so many tables successfully get reindexed and then one of
them (was it 'Direct Business Transactions' or the next one in line?)
fail?
This doesn't make sense. What direction does Set Quoted Identifiers
need to be in for the reindex step of the DB maintenance plan to
succeed? I wish the actual DBCC command was displayed somewhere in this
log also, that would make debugging easier.
Thanks for any information.
David WalkerMore than likely you have a computed column or an indexed view. Both require
certain settings that the MP can't handle. Although I believe this was fixed
in SP4. Otherwise you need to do the reindex in your own custom job with
the proper settings set.
Andrew J. Kelly SQL MVP
"DWalker" <none@.none.com> wrote in message
news:uWrSsgLMGHA.1532@.TK2MSFTNGP12.phx.gbl...
> SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
> I get the following entries in the text log file that the step creates:
> Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
> [1] Database cdw: Index Rebuild (leaving 5%% free space)...
> Rebuilding indexes for table 'Accounts'
> Rebuilding indexes for table 'Advisor Names'
> Rebuilding indexes for table 'Advisor Rep Nums'
> Rebuilding indexes for table 'Asset Master'
> Rebuilding indexes for table 'BP Claim Filed'
> Rebuilding indexes for table 'Breakpoints'
> Rebuilding indexes for table 'BSE Trans Prefixes'
> Rebuilding indexes for table 'BSE Trans Prefixes Rev'
> Rebuilding indexes for table 'BSE Trans Prefixes Std'
> Rebuilding indexes for table 'Core_MM_NFS'
> Rebuilding indexes for table 'Core_MM_Pershing'
> Rebuilding indexes for table 'Dates'
> Rebuilding indexes for table 'Dates_MktOpen'
> Rebuilding indexes for table 'DAZL Delete'
> Rebuilding indexes for table 'Direct Business Transactions'
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft]
[ODBC
> SQL Server Driver][SQL Server]DBCC failed because the following SET
> options have incorrect settings: 'QUOTED_IDENTIFIER'.
> Well it would be nice if it didn't say "INCORRECT SETTING" but instead
> would say that the setting should be ON, or should be OFF. (Quoted
> Identifiers is ON in my database, according to Select
> databasepropertyex.)
> After reading all about quoted identifiers, I didn't think they were
> stored by table -- I thought it was a database-wide property setting.
> According to BOL, "When a table is created, the QUOTED IDENTIFIER option
> is always stored as ON in the table's meta data even if the option is
> set to OFF when the table is created."
> SO, why would so many tables successfully get reindexed and then one of
> them (was it 'Direct Business Transactions' or the next one in line?)
> fail?
> This doesn't make sense. What direction does Set Quoted Identifiers
> need to be in for the reindex step of the DB maintenance plan to
> succeed? I wish the actual DBCC command was displayed somewhere in this
> log also, that would make debugging easier.
> Thanks for any information.
> David Walker|||Hi David
Check out http://support.microsoft.com/defaul...b;en-us;902388,
the particular table probably failed because it is the first that has the
index on a computed column.
If not you may want to look at SQL profiler to see exactly what statements
are being sent to the database by the maintenance plan.
John
"DWalker" wrote:

> SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
> I get the following entries in the text log file that the step creates:
> Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
> [1] Database cdw: Index Rebuild (leaving 5%% free space)...
> Rebuilding indexes for table 'Accounts'
> Rebuilding indexes for table 'Advisor Names'
> Rebuilding indexes for table 'Advisor Rep Nums'
> Rebuilding indexes for table 'Asset Master'
> Rebuilding indexes for table 'BP Claim Filed'
> Rebuilding indexes for table 'Breakpoints'
> Rebuilding indexes for table 'BSE Trans Prefixes'
> Rebuilding indexes for table 'BSE Trans Prefixes Rev'
> Rebuilding indexes for table 'BSE Trans Prefixes Std'
> Rebuilding indexes for table 'Core_MM_NFS'
> Rebuilding indexes for table 'Core_MM_Pershing'
> Rebuilding indexes for table 'Dates'
> Rebuilding indexes for table 'Dates_MktOpen'
> Rebuilding indexes for table 'DAZL Delete'
> Rebuilding indexes for table 'Direct Business Transactions'
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft]
[ODBC
> SQL Server Driver][SQL Server]DBCC failed because the following SET
> options have incorrect settings: 'QUOTED_IDENTIFIER'.
> Well it would be nice if it didn't say "INCORRECT SETTING" but instead
> would say that the setting should be ON, or should be OFF. (Quoted
> Identifiers is ON in my database, according to Select
> databasepropertyex.)
> After reading all about quoted identifiers, I didn't think they were
> stored by table -- I thought it was a database-wide property setting.
> According to BOL, "When a table is created, the QUOTED IDENTIFIER option
> is always stored as ON in the table's meta data even if the option is
> set to OFF when the table is created."
> SO, why would so many tables successfully get reindexed and then one of
> them (was it 'Direct Business Transactions' or the next one in line?)
> fail?
> This doesn't make sense. What direction does Set Quoted Identifiers
> need to be in for the reindex step of the DB maintenance plan to
> succeed? I wish the actual DBCC command was displayed somewhere in this
> log also, that would make debugging easier.
> Thanks for any information.
> David Walker
>|||Thanks to you both. I do have SP4. I'll double-check that table for a
computed column; I created it a long time ago.
David
examnotes <jbellnewsposts@.hotmail.com> wrote in
news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:

> Hi David
> Check out
> http://support.microsoft.com/defaul...b;en-us;902388, the
> particular table probably failed because it is the first that has the
> index on a computed column.
> If not you may want to look at SQL profiler to see exactly what
> statements are being sent to the database by the maintenance plan.
> John
>|||"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:

> More than likely you have a computed column or an indexed view. Both
> require certain settings that the MP can't handle. Although I believe
> this was fixed in SP4. Otherwise you need to do the reindex in your
> own custom job with the proper settings set.
>
Ah, so the maintenance plan generator can't maintain any table that has
computed coumns? Interesting.
It also was complaining about other settings that required the database to
be in single-user mode. WTF? It tries to run statements that require
single-user mode? Maybe it ought to try to put the database in single-user
mode, or maybe that's not a good idea. The check-marks in the maintenance
plan generator ought to tell you that single-user mode is required.
My conclusion from this is that the maintenace plan generator is not
suitable for use on databases in the real world. Is that the right
conclusion?
Thanks.
David|||"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:

> More than likely you have a computed column or an indexed view. Both
> require certain settings that the MP can't handle. Although I believe
> this was fixed in SP4. Otherwise you need to do the reindex in your
> own custom job with the proper settings set.
>
So yes, the table did have one computed column. The table can't be
maintained with a maintenance plan?
Or the indexes can't ever be rebuilt?
David|||Hi David
You may want to look at the code in:
http://support.microsoft.com/defaul...kb;en-us;301292
John
"DWalker" wrote:

> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
> news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:
>
> So yes, the table did have one computed column. The table can't be
> maintained with a maintenance plan?
> Or the indexes can't ever be rebuilt?
> David
>|||examnotes <jbellnewsposts@.hotmail.com> wrote in
news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:

> Hi David
> Check out
> http://support.microsoft.com/defaul...b;en-us;902388, the
> particular table probably failed because it is the first that has the
> index on a computed column.
> If not you may want to look at SQL profiler to see exactly what
> statements are being sent to the database by the maintenance plan.
> John
>
That article is sure confusing; it says "These statements require that
the QUOTED_IDENTIFIER SET option is set to ON."
It *IS* set to On in my database. Then it goes on to say, I think, that
the command is built wrong by the maintenance wizard. Why it couldn't
have been fixed in SP4 without requiring me to add the -
SupportcomputedColumn parameter is not explained...
I added the -SupportComputedColumn option to the plan step, and it will
probably fix it, but I'm still a bit confused by the wording in the
article.
Tthanks for the pointer though!
David Walker|||> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database.
The database setting is essentially useless since it will be overridden by s
ession setting. And most
API's will set this setting, whether the developer is aware of it or not.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"DWalker" <none@.none.com> wrote in message news:%23ZTTnSYMGHA.1532@.TK2MSFTNGP12.phx.gbl...[v
bcol=seagreen]
> examnotes <jbellnewsposts@.hotmail.com> wrote in
> news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:
>
> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database. Then it goes on to say, I think, that
> the command is built wrong by the maintenance wizard. Why it couldn't
> have been fixed in SP4 without requiring me to add the -
> SupportcomputedColumn parameter is not explained...
> I added the -SupportComputedColumn option to the plan step, and it will
> probably fix it, but I'm still a bit confused by the wording in the
> article.
> Tthanks for the pointer though!
> David Walker[/vbcol]|||Hi David
You may want to use the send feedback option at the bottom of the article.
John
"DWalker" wrote:

> examnotes <jbellnewsposts@.hotmail.com> wrote in
> news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:
>
> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database. Then it goes on to say, I think, that
> the command is built wrong by the maintenance wizard. Why it couldn't
> have been fixed in SP4 without requiring me to add the -
> SupportcomputedColumn parameter is not explained...
> I added the -SupportComputedColumn option to the plan step, and it will
> probably fix it, but I'm still a bit confused by the wording in the
> article.
> Tthanks for the pointer though!
> David Walker
>

Quoted identifiers

SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
I get the following entries in the text log file that the step creates:
Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
[1] Database cdw: Index Rebuild (leaving 5%% free space)...
Rebuilding indexes for table 'Accounts'
Rebuilding indexes for table 'Advisor Names'
Rebuilding indexes for table 'Advisor Rep Nums'
Rebuilding indexes for table 'Asset Master'
Rebuilding indexes for table 'BP Claim Filed'
Rebuilding indexes for table 'Breakpoints'
Rebuilding indexes for table 'BSE Trans Prefixes'
Rebuilding indexes for table 'BSE Trans Prefixes Rev'
Rebuilding indexes for table 'BSE Trans Prefixes Std'
Rebuilding indexes for table 'Core_MM_NFS'
Rebuilding indexes for table 'Core_MM_Pershing'
Rebuilding indexes for table 'Dates'
Rebuilding indexes for table 'Dates_MktOpen'
Rebuilding indexes for table 'DAZL Delete'
Rebuilding indexes for table 'Direct Business Transactions'
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft][ODBC
SQL Server Driver][SQL Server]DBCC failed because the following SET
options have incorrect settings: 'QUOTED_IDENTIFIER'.
Well it would be nice if it didn't say "INCORRECT SETTING" but instead
would say that the setting should be ON, or should be OFF. (Quoted
Identifiers is ON in my database, according to Select
databasepropertyex.)
After reading all about quoted identifiers, I didn't think they were
stored by table -- I thought it was a database-wide property setting.
According to BOL, "When a table is created, the QUOTED IDENTIFIER option
is always stored as ON in the table's meta data even if the option is
set to OFF when the table is created."
SO, why would so many tables successfully get reindexed and then one of
them (was it 'Direct Business Transactions' or the next one in line?)
fail?
This doesn't make sense. What direction does Set Quoted Identifiers
need to be in for the reindex step of the DB maintenance plan to
succeed? I wish the actual DBCC command was displayed somewhere in this
log also, that would make debugging easier.
Thanks for any information.
David Walker
More than likely you have a computed column or an indexed view. Both require
certain settings that the MP can't handle. Although I believe this was fixed
in SP4. Otherwise you need to do the reindex in your own custom job with
the proper settings set.
Andrew J. Kelly SQL MVP
"DWalker" <none@.none.com> wrote in message
news:uWrSsgLMGHA.1532@.TK2MSFTNGP12.phx.gbl...
> SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
> I get the following entries in the text log file that the step creates:
> Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
> [1] Database cdw: Index Rebuild (leaving 5%% free space)...
> Rebuilding indexes for table 'Accounts'
> Rebuilding indexes for table 'Advisor Names'
> Rebuilding indexes for table 'Advisor Rep Nums'
> Rebuilding indexes for table 'Asset Master'
> Rebuilding indexes for table 'BP Claim Filed'
> Rebuilding indexes for table 'Breakpoints'
> Rebuilding indexes for table 'BSE Trans Prefixes'
> Rebuilding indexes for table 'BSE Trans Prefixes Rev'
> Rebuilding indexes for table 'BSE Trans Prefixes Std'
> Rebuilding indexes for table 'Core_MM_NFS'
> Rebuilding indexes for table 'Core_MM_Pershing'
> Rebuilding indexes for table 'Dates'
> Rebuilding indexes for table 'Dates_MktOpen'
> Rebuilding indexes for table 'DAZL Delete'
> Rebuilding indexes for table 'Direct Business Transactions'
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft][ODBC
> SQL Server Driver][SQL Server]DBCC failed because the following SET
> options have incorrect settings: 'QUOTED_IDENTIFIER'.
> Well it would be nice if it didn't say "INCORRECT SETTING" but instead
> would say that the setting should be ON, or should be OFF. (Quoted
> Identifiers is ON in my database, according to Select
> databasepropertyex.)
> After reading all about quoted identifiers, I didn't think they were
> stored by table -- I thought it was a database-wide property setting.
> According to BOL, "When a table is created, the QUOTED IDENTIFIER option
> is always stored as ON in the table's meta data even if the option is
> set to OFF when the table is created."
> SO, why would so many tables successfully get reindexed and then one of
> them (was it 'Direct Business Transactions' or the next one in line?)
> fail?
> This doesn't make sense. What direction does Set Quoted Identifiers
> need to be in for the reindex step of the DB maintenance plan to
> succeed? I wish the actual DBCC command was displayed somewhere in this
> log also, that would make debugging easier.
> Thanks for any information.
> David Walker
|||Hi David
Check out http://support.microsoft.com/default...;en-us;902388,
the particular table probably failed because it is the first that has the
index on a computed column.
If not you may want to look at SQL profiler to see exactly what statements
are being sent to the database by the maintenance plan.
John
"DWalker" wrote:

> SQL 2000: I have a DB maintenance plan where one step rebuilds indexes.
> I get the following entries in the text log file that the step creates:
> Starting maintenance plan 'CDW Backup' on 2/13/2006 1:00:02 AM
> [1] Database cdw: Index Rebuild (leaving 5%% free space)...
> Rebuilding indexes for table 'Accounts'
> Rebuilding indexes for table 'Advisor Names'
> Rebuilding indexes for table 'Advisor Rep Nums'
> Rebuilding indexes for table 'Asset Master'
> Rebuilding indexes for table 'BP Claim Filed'
> Rebuilding indexes for table 'Breakpoints'
> Rebuilding indexes for table 'BSE Trans Prefixes'
> Rebuilding indexes for table 'BSE Trans Prefixes Rev'
> Rebuilding indexes for table 'BSE Trans Prefixes Std'
> Rebuilding indexes for table 'Core_MM_NFS'
> Rebuilding indexes for table 'Core_MM_Pershing'
> Rebuilding indexes for table 'Dates'
> Rebuilding indexes for table 'Dates_MktOpen'
> Rebuilding indexes for table 'DAZL Delete'
> Rebuilding indexes for table 'Direct Business Transactions'
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft][ODBC
> SQL Server Driver][SQL Server]DBCC failed because the following SET
> options have incorrect settings: 'QUOTED_IDENTIFIER'.
> Well it would be nice if it didn't say "INCORRECT SETTING" but instead
> would say that the setting should be ON, or should be OFF. (Quoted
> Identifiers is ON in my database, according to Select
> databasepropertyex.)
> After reading all about quoted identifiers, I didn't think they were
> stored by table -- I thought it was a database-wide property setting.
> According to BOL, "When a table is created, the QUOTED IDENTIFIER option
> is always stored as ON in the table's meta data even if the option is
> set to OFF when the table is created."
> SO, why would so many tables successfully get reindexed and then one of
> them (was it 'Direct Business Transactions' or the next one in line?)
> fail?
> This doesn't make sense. What direction does Set Quoted Identifiers
> need to be in for the reindex step of the DB maintenance plan to
> succeed? I wish the actual DBCC command was displayed somewhere in this
> log also, that would make debugging easier.
> Thanks for any information.
> David Walker
>
|||Thanks to you both. I do have SP4. I'll double-check that table for a
computed column; I created it a long time ago.
David
=?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:

> Hi David
> Check out
> http://support.microsoft.com/default...;en-us;902388, the
> particular table probably failed because it is the first that has the
> index on a computed column.
> If not you may want to look at SQL profiler to see exactly what
> statements are being sent to the database by the maintenance plan.
> John
>
|||"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:

> More than likely you have a computed column or an indexed view. Both
> require certain settings that the MP can't handle. Although I believe
> this was fixed in SP4. Otherwise you need to do the reindex in your
> own custom job with the proper settings set.
>
Ah, so the maintenance plan generator can't maintain any table that has
computed coumns? Interesting.
It also was complaining about other settings that required the database to
be in single-user mode. WTF? It tries to run statements that require
single-user mode? Maybe it ought to try to put the database in single-user
mode, or maybe that's not a good idea. The check-marks in the maintenance
plan generator ought to tell you that single-user mode is required.
My conclusion from this is that the maintenace plan generator is not
suitable for use on databases in the real world. Is that the right
conclusion?
Thanks.
David
|||"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:

> More than likely you have a computed column or an indexed view. Both
> require certain settings that the MP can't handle. Although I believe
> this was fixed in SP4. Otherwise you need to do the reindex in your
> own custom job with the proper settings set.
>
So yes, the table did have one computed column. The table can't be
maintained with a maintenance plan?
Or the indexes can't ever be rebuilt?
David
|||Hi David
You may want to look at the code in:
http://support.microsoft.com/default...b;en-us;301292
John
"DWalker" wrote:

> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in
> news:#UsAzvMMGHA.2628@.TK2MSFTNGP15.phx.gbl:
>
> So yes, the table did have one computed column. The table can't be
> maintained with a maintenance plan?
> Or the indexes can't ever be rebuilt?
> David
>
|||=?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:

> Hi David
> Check out
> http://support.microsoft.com/default...;en-us;902388, the
> particular table probably failed because it is the first that has the
> index on a computed column.
> If not you may want to look at SQL profiler to see exactly what
> statements are being sent to the database by the maintenance plan.
> John
>
That article is sure confusing; it says "These statements require that
the QUOTED_IDENTIFIER SET option is set to ON."
It *IS* set to On in my database. Then it goes on to say, I think, that
the command is built wrong by the maintenance wizard. Why it couldn't
have been fixed in SP4 without requiring me to add the -
SupportcomputedColumn parameter is not explained...
I added the -SupportComputedColumn option to the plan step, and it will
probably fix it, but I'm still a bit confused by the wording in the
article.
Tthanks for the pointer though!
David Walker
|||> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database.
The database setting is essentially useless since it will be overridden by session setting. And most
API's will set this setting, whether the developer is aware of it or not.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"DWalker" <none@.none.com> wrote in message news:%23ZTTnSYMGHA.1532@.TK2MSFTNGP12.phx.gbl...
> =?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
> news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:
>
> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database. Then it goes on to say, I think, that
> the command is built wrong by the maintenance wizard. Why it couldn't
> have been fixed in SP4 without requiring me to add the -
> SupportcomputedColumn parameter is not explained...
> I added the -SupportComputedColumn option to the plan step, and it will
> probably fix it, but I'm still a bit confused by the wording in the
> article.
> Tthanks for the pointer though!
> David Walker
|||Hi David
You may want to use the send feedback option at the bottom of the article.
John
"DWalker" wrote:

> =?Utf-8?B?Sm9obiBCZWxs?= <jbellnewsposts@.hotmail.com> wrote in
> news:D8618655-6673-4DBD-BB77-7E0EE21F75C1@.microsoft.com:
>
> That article is sure confusing; it says "These statements require that
> the QUOTED_IDENTIFIER SET option is set to ON."
> It *IS* set to On in my database. Then it goes on to say, I think, that
> the command is built wrong by the maintenance wizard. Why it couldn't
> have been fixed in SP4 without requiring me to add the -
> SupportcomputedColumn parameter is not explained...
> I added the -SupportComputedColumn option to the plan step, and it will
> probably fix it, but I'm still a bit confused by the wording in the
> article.
> Tthanks for the pointer though!
> David Walker
>