Showing posts with label basic. Show all posts
Showing posts with label basic. Show all posts

Wednesday, March 21, 2012

Error on Index!

Hi, I am having a real headache with a table in my db, one of these days
we found that some basic select queries were taking like 4 minutes, to
execute, and they shouldn’t take more that one second, so we were getting
hundreds of timeouts between our applications, I was assigned to check
what was happening, and I ran a script that i found on the web, that takes
every table of the schema and then reindex it, well the thing was in that
specific table the scrip got an error telling me this:
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 169: [Microsoft][ODBC SQL
Server Driver][SQL Server]A column has been specified more than once in
the order by list. Columns in the order by list must be unique.
I check all the indexes in that table and i found 4, but none of them had
an order by column duplicated, I even restore the db somewhere else and
played with those indexes, but it seems like I cant delete one of them the
first one, my index script is the following:
CREATE CLUSTERED INDEX [IX_Accountno] ON [dbo].[tblaction]([AccountNo],
[yearno], [wNo], [Dayno]) ON [PRIMARY]
GO
CREATE INDEX [Gradectrl] ON [dbo].[tblaction]([GradeCtrl]) WITH
FILLFACTOR = 90 ON [PRIMARY]
GO
CREATE INDEX [Linelink] ON [dbo].[tblaction]([LineLINK]) WITH
FILLFACTOR = 90 ON [PRIMARY]
GO
CREATE INDEX [ticketno] ON [dbo].[tblaction]([TicketNo]) WITH
FILLFACTOR = 90 ON [PRIMARY]
GO
CREATE INDEX [IX_tblaction] ON [dbo].[tblaction]([yearno], [wNo],
[Dayno]) ON [PRIMARY]
GO
I tried to remove them all and then recreate them , but when I try to
delete the clustered one, the error pops again and doesn’t let me delete
it, I also check the whole db script to see if i got something else in
another place, but I didn’t found anything... any suggestions?
How can i remove all the indexes, and / or get rid of this slowing error?
Thanks for your time
PD: The following is the reindex script
DECLARE @.MyTable varchar(255)
DECLARE myCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = 'base table'
OPEN myCursor
FETCH NEXT FROM myCursor INTO @.MyTable
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'Reindexing Table: ' + @.MyTable
DBCC DBREINDEX(@.MyTable, '', 90)
FETCH NEXT FROM myCursor INTO @.MyTable
END
CLOSE myCursor
DEALLOCATE myCursor
EXEC sp_updatestats
--Thanks!
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/- Can check the output of sp_helpindex table_name?
- Can you try to recreate the clustered index with the option DROP_EXISTING?
AMB
"Edgardo Sepulveda" wrote:

> Hi, I am having a real headache with a table in my db, one of these days
> we found that some basic select queries were taking like 4 minutes, to
> execute, and they shouldn’t take more that one second, so we were gettin
g
> hundreds of timeouts between our applications, I was assigned to check
> what was happening, and I ran a script that i found on the web, that takes
> every table of the schema and then reindex it, well the thing was in that
> specific table the scrip got an error telling me this:
>
> [Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 169: [Microsoft][ODBC SQL
> Server Driver][SQL Server]A column has been specified more than once in
> the order by list. Columns in the order by list must be unique.
> I check all the indexes in that table and i found 4, but none of them had
> an order by column duplicated, I even restore the db somewhere else and
> played with those indexes, but it seems like I cant delete one of them the
> first one, my index script is the following:
> CREATE CLUSTERED INDEX [IX_Accountno] ON [dbo].[tblaction]([AccountNo],
> [yearno], [wNo], [Dayno]) ON [PRIMARY]
> GO
> CREATE INDEX [Gradectrl] ON [dbo].[tblaction]([GradeCtrl]) WITH
> FILLFACTOR = 90 ON [PRIMARY]
> GO
> CREATE INDEX [Linelink] ON [dbo].[tblaction]([LineLINK]) WITH
> FILLFACTOR = 90 ON [PRIMARY]
> GO
> CREATE INDEX [ticketno] ON [dbo].[tblaction]([TicketNo]) WITH
> FILLFACTOR = 90 ON [PRIMARY]
> GO
> CREATE INDEX [IX_tblaction] ON [dbo].[tblaction]([yearno], [wNo],
> [Dayno]) ON [PRIMARY]
> GO
> I tried to remove them all and then recreate them , but when I try to
> delete the clustered one, the error pops again and doesn’t let me delete
> it, I also check the whole db script to see if i got something else in
> another place, but I didn’t found anything... any suggestions?
> How can i remove all the indexes, and / or get rid of this slowing error?
>
> Thanks for your time
>
>
> PD: The following is the reindex script
>
>
> DECLARE @.MyTable varchar(255)
> DECLARE myCursor CURSOR FOR
> SELECT table_name FROM information_schema.tables
> WHERE table_type = 'base table'
> OPEN myCursor
> FETCH NEXT FROM myCursor INTO @.MyTable
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> PRINT 'Reindexing Table: ' + @.MyTable
> DBCC DBREINDEX(@.MyTable, '', 90)
> FETCH NEXT FROM myCursor INTO @.MyTable
> END
> CLOSE myCursor
> DEALLOCATE myCursor
> EXEC sp_updatestats
>
> --Thanks!
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
>|||The output of the sp_helpindex was:
aaaaatblaction_PK nonclustered, unique, primary key located on PRIMARY ID
Gradectrl nonclustered located on PRIMARY GradeCtrl
hind_1612584833_58A_83A nonclustered, hypothetical, auto create located on
PRIMARY wNo, yearno
hind_1612584833_83A_58A nonclustered, hypothetical, auto create located on
PRIMARY yearno, wNo
hind_c_1612584833_34A clustered, hypothetical, auto create located on
PRIMARY GradeCtrl
hind_c_1612584833_58A clustered, hypothetical, auto create located on
PRIMARY wNo
hind_c_1612584833_83A clustered, hypothetical, auto create located on
PRIMARY yearno
hind_c_1612584833_83A_58A clustered, hypothetical, auto create located on
PRIMARY yearno, wNo
IX_Accountno clustered located on PRIMARY AccountNo, yearno, wNo, Dayno
IX_tblaction nonclustered located on PRIMARY yearno, wNo, Dayno
Linelink nonclustered located on PRIMARY LineLINK
ticketno nonclustered located on PRIMARY TicketNo
I think this is the problem, too many indexes. or too many combinations.
Thanks for the tip Alejandro, any suggestions Based on this info?
Thanks for your Time.
Edgardo

Friday, February 24, 2012

Error Message requires explanation please

Hi
I am a basic user and need to know what this error message means
10025 Write to SQL Server faile
The database that I was using (external application has data hosted to SQL Server 2000) was idle at the time. I understand that this could be a network problem. Is it something as simple as a timeout issue, and if so, how do I rectify this
This message was also displayed
Context: SQLOptLockErrPara
dbo.CA
What does this mean? If anyone could give me an example of why this happens I would really appreciate it
Thank
ShnibniHi!
Do please check if the article at
http://support.microsoft.com/default.aspx?scid=kb;en-us;109787 helps you.
--
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Shnibnib" <anonymous@.discussions.microsoft.com> wrote in message
news:52137B66-4562-4EE9-A579-65E6346ED76F@.microsoft.com...
> Hi,
> I am a basic user and need to know what this error message means:
> 10025 Write to SQL Server failed
> The database that I was using (external application has data hosted to SQL
Server 2000) was idle at the time. I understand that this could be a
network problem. Is it something as simple as a timeout issue, and if so,
how do I rectify this?
> This message was also displayed:
> Context: SQLOptLockErrParam
> dbo.CAL
> What does this mean? If anyone could give me an example of why this
happens I would really appreciate it.
> Thanks
> Shnibnib
>

Error Message requires explanation please

Hi,
I am a basic user and need to know what this error message means:
10025 Write to SQL Server failed
The database that I was using (external application has data hosted to SQL S
erver 2000) was idle at the time. I understand that this could be a network
problem. Is it something as simple as a timeout issue, and if so, how do I
rectify this?
This message was also displayed:
Context: SQLOptLockErrParam
dbo.CAL
What does this mean? If anyone could give me an example of why this happens
I would really appreciate it.
Thanks
ShnibnibHi!
Do please check if the article at
http://support.microsoft.com/defaul...kb;en-us;109787 helps you.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Shnibnib" <anonymous@.discussions.microsoft.com> wrote in message
news:52137B66-4562-4EE9-A579-65E6346ED76F@.microsoft.com...
> Hi,
> I am a basic user and need to know what this error message means:
> 10025 Write to SQL Server failed
> The database that I was using (external application has data hosted to SQL
Server 2000) was idle at the time. I understand that this could be a
network problem. Is it something as simple as a timeout issue, and if so,
how do I rectify this?
> This message was also displayed:
> Context: SQLOptLockErrParam
> dbo.CAL
> What does this mean? If anyone could give me an example of why this
happens I would really appreciate it.
> Thanks
> Shnibnib
>

Sunday, February 19, 2012

Error message ID returned to the application

Hello,
I want to know whether I could get the Raiserror's message id in the front
end's application, (coded in Visual Basic or Delphi).
Thanks in advance
FrankFrank
Read up about sysmessages system table in the BOL
"Frank" <wangping@.lucent.com> wrote in message
news:%23VfqSgyPFHA.2252@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I want to know whether I could get the Raiserror's message id in the front
> end's application, (coded in Visual Basic or Delphi).
> Thanks in advance
> Frank
>|||Hi Frank
To add to Uri's reply also check out severity levels in BOL. Getting the
value of the error will depend on what the front end application is e.g. ADO
has the ADOErrors collection.
John
"Frank" wrote:

> Hello,
> I want to know whether I could get the Raiserror's message id in the front
> end's application, (coded in Visual Basic or Delphi).
> Thanks in advance
> Frank
>
>|||Dimant,
Thanks for your quick response.
Actually here is the scenario,
I am using Delphi to access the SQL Server, and in my Delphi code, I need to
deal with errors which could come from the SQL Server, and in my Delphi
code, there are exception handlers like the following,
Try
something dealing with the SQL Server and something wrong
Except on E.Exception
If pos('Communication Like Failure', E.message)>0 then
//It is the connection error and do my error handling for connection.
End
And in the above pos('Communication Like Failure', E.message), I judge
whether the connection is broken or not only depend on whether the E.message
includes the 'Communication Like Failure' word.
What I think could be more accurate is that if I could get the error number
of the 'Communication Like Failure', and judge by the number.
Hope I have expressed well.
Thanks
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:etUmtkyPFHA.3384@.TK2MSFTNGP10.phx.gbl...
> Frank
> Read up about sysmessages system table in the BOL
>
> "Frank" <wangping@.lucent.com> wrote in message
> news:%23VfqSgyPFHA.2252@.TK2MSFTNGP15.phx.gbl...
front
>|||Hi
If you are using TADOConnection you can check the errors collection in
that. The NativeError attribute of each item will give the SQL Server
error number.
John|||Thanks John,
That works.
Frank
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:1113408160.705790.30670@.o13g2000cwo.googlegroups.com...
> Hi
> If you are using TADOConnection you can check the errors collection in
> that. The NativeError attribute of each item will give the SQL Server
> error number.
> John
>