Tuesday, March 27, 2012
Field by Position
My scope was to duplicate a row into a table with identity column getting all row except the identity one, that i want to provided by constant expression.
Bye and thanks...
:D :DYou will need to use dynamic SQL (constructing your SQL Statements at runtime) by referencing the database Schema or the sysobjects and syscolumns tables.|||Uhmmm...why do you need to do this...?|||Often I have duplicate row in table with a lot of columns ... and i wanted a statement to avoid to call each time columns by name ...
The real scope was to find a statement to say : "Get all the columns except primary key ... that I provide by constant expression ...."
Maybe the unique solution is to prepare a program to write statement how i need
Thanks|||why not just write the query with all the column names except the primary key?
that would've taken no more than a minute or two, a lot faster than writing a query to go against the system tables, and a lot faster than writing a program to do that
Wednesday, March 21, 2012
Fatal exception error in MSSQL2005 SP1
that, I got some dump logs between 8pm to 10pm. Any idea? Thanks in advance
****************SQLDUMP.LOG**************
Memory
MemoryLoad = 90%
Total Physical = 2047 MB
Available Physical = 202 MB
Total Page File = 3947 MB
Available Page File = 2046 MB
Total Virtual = 2047 MB
Available Virtual = 93 MB
***Stack Dump being sent to C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\LOG\SQLDump0002.txt
SqlDumpExceptionHandler: Process 70 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is
terminating this process.
*
*******************************************************************************
*
* BEGIN STACK DUMP:
* 07/20/06 20:26:18 spid 70
*
*
* Exception Address = 7C8224B2 Module(ntdll+000224B2)
* Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
* Access Violation occurred reading address 00000003
* Input Buffer 510 bytes -
* select a.currencycode, a.glmasterno, a.loanrefno, a.customerid, a.contra
* cttype, a.NewLoanBaln, a.TtlAccrueInt, substring(b.duedate,5,2) + '/' +
* substring(b.duedate,3,2) + '/' + substring(b.duedate,1,2) as DueDate_Fox
* Pro, b.* from eximbills_drawfm00 a right join (select I.*, P.schedulep
* rincipal as MerchedPrincipal, P.penaltotalinterest as Ppenality from (se
* lect * from (Select *, case when left(duedate,2) > '78' then '19' + d
* uedate else '20' + duedate end as modi_duedate from eximbills_drawfpsf w
* here right(kpsfkey,1) = 'I') z where modi_duedate between '20060603' a
* nd '20060803' and payoutflag <> 'Y') I join (select scheduleprincipal
* , kpsfkey, penaltotalinterest from (Select *, case when left(duedate,
* 2) > '78' then '19' + duedate else '20' + duedate end as modi_duedate fr
* om eximbills_drawfpsf where right(kpsfkey,1) = 'P') x where modi_dueda
* te between '20060603' and '20060803' and payoutflag <> 'Y') P on le
* ft(I.kpsfkey,25) = left(P.kpsfkey,25)) b on rtrim(ltrim(a.loanrefno)) =
* substring(b.kpsfkey,1,12) where rtrim(ltrim(a.recordtype)) <> '009' or
* der by loanrefno, kpsfkey
****************SQLDUMPER_ERRORLOG**************
07/20/06 20:24:58, ERROR , SQLDUMPER_UNKNOWN_APP.EXE, AdjustTokenPrivileges
() failed (00000514)
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Input parameters: 4
supplied
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ProcessID = 1744
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ThreadId = 0
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Flags = 0x0
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDumpFlags = 0x0
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, SqlInfoPtr = 0x02A03570
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, DumpDir = <NULL>
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExceptionRecordPtr
= 0x00000000
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ContextPtr = 0x00000000
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExtraFile = <NULL>
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, InstanceName = <NULL>
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ServiceName = <NULL>
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Dump is associated
with file C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\LOG\SQLDump0001.txt
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 11 not
used
07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 7 not used
07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDump completed:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLDump0001.mdmp
07/20/06 20:25:03, ACTION, sqlservr.exe, Watson Invoke: NoHi stephanie
Have you run this query successfully from query analyser? Have you run DBCC
CHECKDB and made sure that there are no hardware errors or other errors
reported in the event log?
You may want to look at re-writing the query. It is best not not use SELECT
* in production code as you will be selecting more than you are using. Post
DDL and sample data with the expected output from that data if you need help
re-writing this see http://www.aspfaq.com/etiquette.asp?id=5006
John
"stephanie" wrote:
> The SQL server was terminated by exception acess violation at 10pm but before
> that, I got some dump logs between 8pm to 10pm. Any idea? Thanks in advance
> ****************SQLDUMP.LOG**************
> Memory
> MemoryLoad = 90%
> Total Physical = 2047 MB
> Available Physical = 202 MB
> Total Page File = 3947 MB
> Available Page File = 2046 MB
> Total Virtual = 2047 MB
> Available Virtual = 93 MB
> ***Stack Dump being sent to C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\LOG\SQLDump0002.txt
> SqlDumpExceptionHandler: Process 70 generated fatal exception c0000005
> EXCEPTION_ACCESS_VIOLATION. SQL Server is
> terminating this process.
> *
> *******************************************************************************
> *
> * BEGIN STACK DUMP:
> * 07/20/06 20:26:18 spid 70
> *
> *
> * Exception Address = 7C8224B2 Module(ntdll+000224B2)
> * Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
> * Access Violation occurred reading address 00000003
> * Input Buffer 510 bytes -
> * select a.currencycode, a.glmasterno, a.loanrefno, a.customerid, a.contra
> * cttype, a.NewLoanBaln, a.TtlAccrueInt, substring(b.duedate,5,2) + '/' +
> * substring(b.duedate,3,2) + '/' + substring(b.duedate,1,2) as DueDate_Fox
> * Pro, b.* from eximbills_drawfm00 a right join (select I.*, P.schedulep
> * rincipal as MerchedPrincipal, P.penaltotalinterest as Ppenality from (se
> * lect * from (Select *, case when left(duedate,2) > '78' then '19' + d
> * uedate else '20' + duedate end as modi_duedate from eximbills_drawfpsf w
> * here right(kpsfkey,1) = 'I') z where modi_duedate between '20060603' a
> * nd '20060803' and payoutflag <> 'Y') I join (select scheduleprincipal
> * , kpsfkey, penaltotalinterest from (Select *, case when left(duedate,
> * 2) > '78' then '19' + duedate else '20' + duedate end as modi_duedate fr
> * om eximbills_drawfpsf where right(kpsfkey,1) = 'P') x where modi_dueda
> * te between '20060603' and '20060803' and payoutflag <> 'Y') P on le
> * ft(I.kpsfkey,25) = left(P.kpsfkey,25)) b on rtrim(ltrim(a.loanrefno)) => * substring(b.kpsfkey,1,12) where rtrim(ltrim(a.recordtype)) <> '009' or
> * der by loanrefno, kpsfkey
>
> ****************SQLDUMPER_ERRORLOG**************
> 07/20/06 20:24:58, ERROR , SQLDUMPER_UNKNOWN_APP.EXE, AdjustTokenPrivileges
> () failed (00000514)
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Input parameters: 4
> supplied
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ProcessID = 1744
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ThreadId = 0
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Flags = 0x0
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDumpFlags = 0x0
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, SqlInfoPtr => 0x02A03570
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, DumpDir = <NULL>
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExceptionRecordPtr
> = 0x00000000
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ContextPtr => 0x00000000
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExtraFile = <NULL>
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, InstanceName => <NULL>
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ServiceName = <NULL>
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Dump is associated
> with file C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\LOG\SQLDump0001.txt
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 11 not
> used
> 07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 7 not used
> 07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDump completed:
> C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLDump0001.mdmp
> 07/20/06 20:25:03, ACTION, sqlservr.exe, Watson Invoke: No|||The query is working fine with running in query analyzer and there is no
error in dbcc checkdb. I found that there was an error in event viewer about
fatal exception with win32 or c++ when the MSSQL2005 stopped unexpectedly.
SQL Server is terminating because of fatal exception c0000005. This error
may be caused by an unhandled Win32 or C++ exception, or by an access
violation encountered during exception handling. Check the SQL error log for
any related stack dumps or messages. This exception forces SQL Server to
shutdown. To recover from this error, restart the server (unless SQLAgent is
configured to auto restart).
Thanks in advance!
"John Bell" wrote:
> Hi stephanie
> Have you run this query successfully from query analyser? Have you run DBCC
> CHECKDB and made sure that there are no hardware errors or other errors
> reported in the event log?
> You may want to look at re-writing the query. It is best not not use SELECT
> * in production code as you will be selecting more than you are using. Post
> DDL and sample data with the expected output from that data if you need help
> re-writing this see http://www.aspfaq.com/etiquette.asp?id=5006
> John
> "stephanie" wrote:
> > The SQL server was terminated by exception acess violation at 10pm but before
> > that, I got some dump logs between 8pm to 10pm. Any idea? Thanks in advance
> > ****************SQLDUMP.LOG**************
> > Memory
> > MemoryLoad = 90%
> > Total Physical = 2047 MB
> > Available Physical = 202 MB
> > Total Page File = 3947 MB
> > Available Page File = 2046 MB
> > Total Virtual = 2047 MB
> > Available Virtual = 93 MB
> > ***Stack Dump being sent to C:\Program Files\Microsoft SQL
> > Server\MSSQL.1\MSSQL\LOG\SQLDump0002.txt
> > SqlDumpExceptionHandler: Process 70 generated fatal exception c0000005
> > EXCEPTION_ACCESS_VIOLATION. SQL Server is
> > terminating this process.
> >
> > *
> > *******************************************************************************
> > *
> >
> > * BEGIN STACK DUMP:
> >
> > * 07/20/06 20:26:18 spid 70
> >
> > *
> >
> > *
> >
> > * Exception Address = 7C8224B2 Module(ntdll+000224B2)
> >
> > * Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
> >
> > * Access Violation occurred reading address 00000003
> >
> > * Input Buffer 510 bytes -
> >
> > * select a.currencycode, a.glmasterno, a.loanrefno, a.customerid, a.contra
> >
> > * cttype, a.NewLoanBaln, a.TtlAccrueInt, substring(b.duedate,5,2) + '/' +
> >
> > * substring(b.duedate,3,2) + '/' + substring(b.duedate,1,2) as DueDate_Fox
> >
> > * Pro, b.* from eximbills_drawfm00 a right join (select I.*, P.schedulep
> >
> > * rincipal as MerchedPrincipal, P.penaltotalinterest as Ppenality from (se
> >
> > * lect * from (Select *, case when left(duedate,2) > '78' then '19' + d
> >
> > * uedate else '20' + duedate end as modi_duedate from eximbills_drawfpsf w
> >
> > * here right(kpsfkey,1) = 'I') z where modi_duedate between '20060603' a
> >
> > * nd '20060803' and payoutflag <> 'Y') I join (select scheduleprincipal
> >
> > * , kpsfkey, penaltotalinterest from (Select *, case when left(duedate,
> >
> > * 2) > '78' then '19' + duedate else '20' + duedate end as modi_duedate fr
> >
> > * om eximbills_drawfpsf where right(kpsfkey,1) = 'P') x where modi_dueda
> >
> > * te between '20060603' and '20060803' and payoutflag <> 'Y') P on le
> >
> > * ft(I.kpsfkey,25) = left(P.kpsfkey,25)) b on rtrim(ltrim(a.loanrefno)) => >
> > * substring(b.kpsfkey,1,12) where rtrim(ltrim(a.recordtype)) <> '009' or
> >
> > * der by loanrefno, kpsfkey
> >
> >
> > ****************SQLDUMPER_ERRORLOG**************
> > 07/20/06 20:24:58, ERROR , SQLDUMPER_UNKNOWN_APP.EXE, AdjustTokenPrivileges
> > () failed (00000514)
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Input parameters: 4
> > supplied
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ProcessID = 1744
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ThreadId = 0
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Flags = 0x0
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDumpFlags = 0x0
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, SqlInfoPtr => > 0x02A03570
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, DumpDir = <NULL>
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExceptionRecordPtr
> > = 0x00000000
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ContextPtr => > 0x00000000
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExtraFile = <NULL>
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, InstanceName => > <NULL>
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ServiceName = <NULL>
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Dump is associated
> > with file C:\Program Files\Microsoft SQL
> > Server\MSSQL.1\MSSQL\LOG\SQLDump0001.txt
> > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 11 not
> > used
> > 07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 7 not used
> > 07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDump completed:
> > C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLDump0001.mdmp
> > 07/20/06 20:25:03, ACTION, sqlservr.exe, Watson Invoke: No|||Hi Stephanie
There are a couple of issues logged at:
https://connect.microsoft.com/SQLServer/feedback/SearchResults.aspx?SearchQuery=c0000005
they mainly seem to be the 64 bit version. You could try the post SP1 hotfix
on a test server http://support.microsoft.com/Kb/918222 is publically
available and there are others available from PSS see
http://www.sqlsecurity.com/FAQs/SQLServerVersionDatabase/tabid/63/Default.aspx
I think the issue may be related to the complexity of the query, so you may
want to try and re-write it or reduce it to find the point when it fails.
You may also want to raise a call with PSS and pass on any dump files that
you have.
John
"stephanie" wrote:
> The query is working fine with running in query analyzer and there is no
> error in dbcc checkdb. I found that there was an error in event viewer about
> fatal exception with win32 or c++ when the MSSQL2005 stopped unexpectedly.
> SQL Server is terminating because of fatal exception c0000005. This error
> may be caused by an unhandled Win32 or C++ exception, or by an access
> violation encountered during exception handling. Check the SQL error log for
> any related stack dumps or messages. This exception forces SQL Server to
> shutdown. To recover from this error, restart the server (unless SQLAgent is
> configured to auto restart).
>
> Thanks in advance!
> "John Bell" wrote:
> > Hi stephanie
> >
> > Have you run this query successfully from query analyser? Have you run DBCC
> > CHECKDB and made sure that there are no hardware errors or other errors
> > reported in the event log?
> >
> > You may want to look at re-writing the query. It is best not not use SELECT
> > * in production code as you will be selecting more than you are using. Post
> > DDL and sample data with the expected output from that data if you need help
> > re-writing this see http://www.aspfaq.com/etiquette.asp?id=5006
> >
> > John
> >
> > "stephanie" wrote:
> >
> > > The SQL server was terminated by exception acess violation at 10pm but before
> > > that, I got some dump logs between 8pm to 10pm. Any idea? Thanks in advance
> > > ****************SQLDUMP.LOG**************
> > > Memory
> > > MemoryLoad = 90%
> > > Total Physical = 2047 MB
> > > Available Physical = 202 MB
> > > Total Page File = 3947 MB
> > > Available Page File = 2046 MB
> > > Total Virtual = 2047 MB
> > > Available Virtual = 93 MB
> > > ***Stack Dump being sent to C:\Program Files\Microsoft SQL
> > > Server\MSSQL.1\MSSQL\LOG\SQLDump0002.txt
> > > SqlDumpExceptionHandler: Process 70 generated fatal exception c0000005
> > > EXCEPTION_ACCESS_VIOLATION. SQL Server is
> > > terminating this process.
> > >
> > > *
> > > *******************************************************************************
> > > *
> > >
> > > * BEGIN STACK DUMP:
> > >
> > > * 07/20/06 20:26:18 spid 70
> > >
> > > *
> > >
> > > *
> > >
> > > * Exception Address = 7C8224B2 Module(ntdll+000224B2)
> > >
> > > * Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
> > >
> > > * Access Violation occurred reading address 00000003
> > >
> > > * Input Buffer 510 bytes -
> > >
> > > * select a.currencycode, a.glmasterno, a.loanrefno, a.customerid, a.contra
> > >
> > > * cttype, a.NewLoanBaln, a.TtlAccrueInt, substring(b.duedate,5,2) + '/' +
> > >
> > > * substring(b.duedate,3,2) + '/' + substring(b.duedate,1,2) as DueDate_Fox
> > >
> > > * Pro, b.* from eximbills_drawfm00 a right join (select I.*, P.schedulep
> > >
> > > * rincipal as MerchedPrincipal, P.penaltotalinterest as Ppenality from (se
> > >
> > > * lect * from (Select *, case when left(duedate,2) > '78' then '19' + d
> > >
> > > * uedate else '20' + duedate end as modi_duedate from eximbills_drawfpsf w
> > >
> > > * here right(kpsfkey,1) = 'I') z where modi_duedate between '20060603' a
> > >
> > > * nd '20060803' and payoutflag <> 'Y') I join (select scheduleprincipal
> > >
> > > * , kpsfkey, penaltotalinterest from (Select *, case when left(duedate,
> > >
> > > * 2) > '78' then '19' + duedate else '20' + duedate end as modi_duedate fr
> > >
> > > * om eximbills_drawfpsf where right(kpsfkey,1) = 'P') x where modi_dueda
> > >
> > > * te between '20060603' and '20060803' and payoutflag <> 'Y') P on le
> > >
> > > * ft(I.kpsfkey,25) = left(P.kpsfkey,25)) b on rtrim(ltrim(a.loanrefno)) => > >
> > > * substring(b.kpsfkey,1,12) where rtrim(ltrim(a.recordtype)) <> '009' or
> > >
> > > * der by loanrefno, kpsfkey
> > >
> > >
> > > ****************SQLDUMPER_ERRORLOG**************
> > > 07/20/06 20:24:58, ERROR , SQLDUMPER_UNKNOWN_APP.EXE, AdjustTokenPrivileges
> > > () failed (00000514)
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Input parameters: 4
> > > supplied
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ProcessID = 1744
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ThreadId = 0
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Flags = 0x0
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDumpFlags = 0x0
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, SqlInfoPtr => > > 0x02A03570
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, DumpDir = <NULL>
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExceptionRecordPtr
> > > = 0x00000000
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ContextPtr => > > 0x00000000
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExtraFile = <NULL>
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, InstanceName => > > <NULL>
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ServiceName = <NULL>
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Dump is associated
> > > with file C:\Program Files\Microsoft SQL
> > > Server\MSSQL.1\MSSQL\LOG\SQLDump0001.txt
> > > 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 11 not
> > > used
> > > 07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 7 not used
> > > 07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDump completed:
> > > C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLDump0001.mdmp
> > > 07/20/06 20:25:03, ACTION, sqlservr.exe, Watson Invoke: Nosql
Fatal exception error in MSSQL2005 SP1
e
that, I got some dump logs between 8pm to 10pm. Any idea? Thanks in advanc
e
****************SQLDUMP.LOG**************
Memory
MemoryLoad = 90%
Total Physical = 2047 MB
Available Physical = 202 MB
Total Page File = 3947 MB
Available Page File = 2046 MB
Total Virtual = 2047 MB
Available Virtual = 93 MB
***Stack Dump being sent to C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\LOG\SQLDump0002.txt
SqlDumpExceptionHandler: Process 70 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is
terminating this process.
*
****************************************
************************************
***
*
* BEGIN STACK DUMP:
* 07/20/06 20:26:18 spid 70
*
*
* Exception Address = 7C8224B2 Module(ntdll+000224B2)
* Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
* Access Violation occurred reading address 00000003
* Input Buffer 510 bytes -
* select a.currencycode, a.glmasterno, a.loanrefno, a.customerid, a.contra
* cttype, a.NewLoanBaln, a.TtlAccrueInt, substring(b.duedate,5,2) + '/' +
* substring(b.duedate,3,2) + '/' + substring(b.duedate,1,2) as DueDate_Fox
* Pro, b.* from eximbills_drawfm00 a right join (select I.*, P.schedulep
* rincipal as MerchedPrincipal, P.penaltotalinterest as Ppenality from (se
* lect * from (Select *, case when left(duedate,2) > '78' then '19' + d
* uedate else '20' + duedate end as modi_duedate from eximbills_drawfpsf w
* here right(kpsfkey,1) = 'I') z where modi_duedate between '20060603' a
* nd '20060803' and payoutflag <> 'Y') I join (select scheduleprincipal
* , kpsfkey, penaltotalinterest from (Select *, case when left(duedate,
* 2) > '78' then '19' + duedate else '20' + duedate end as modi_duedate fr
* om eximbills_drawfpsf where right(kpsfkey,1) = 'P') x where modi_dueda
* te between '20060603' and '20060803' and payoutflag <> 'Y') P on le
* ft(I.kpsfkey,25) = left(P.kpsfkey,25)) b on rtrim(ltrim(a.loanrefno)) =
* substring(b.kpsfkey,1,12) where rtrim(ltrim(a.recordtype)) <> '009' or
* der by loanrefno, kpsfkey
****************SQLDUMPER_ERRORLOG******
********
07/20/06 20:24:58, ERROR , SQLDUMPER_UNKNOWN_APP.EXE, AdjustTokenPrivileges
() failed (00000514)
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Input parameters: 4
supplied
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ProcessID = 1744
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ThreadId = 0
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Flags = 0x0
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDumpFlags = 0x
0
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, SqlInfoPtr =
0x02A03570
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, DumpDir = <NULL>
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExceptionRecordPtr
= 0x00000000
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ContextPtr =
0x00000000
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExtraFile = <NULL>
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, InstanceName =
<NULL>
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ServiceName = <NUL
L>
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Dump is associated
with file C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\LOG\SQLDump0001.txt
07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 11 not
used
07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 7 not us
ed
07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDump completed:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLDump0001.mdmp
07/20/06 20:25:03, ACTION, sqlservr.exe, Watson Invoke: NoHi stephanie
Have you run this query successfully from query analyser? Have you run DBCC
CHECKDB and made sure that there are no hardware errors or other errors
reported in the event log?
You may want to look at re-writing the query. It is best not not use SELECT
* in production code as you will be selecting more than you are using. Post
DDL and sample data with the expected output from that data if you need help
re-writing this see http://www.aspfaq.com/etiquette.asp?id=5006
John
"stephanie" wrote:
> The SQL server was terminated by exception acess violation at 10pm but bef
ore
> that, I got some dump logs between 8pm to 10pm. Any idea? Thanks in adva
nce
> ****************SQLDUMP.LOG**************
> Memory
> MemoryLoad = 90%
> Total Physical = 2047 MB
> Available Physical = 202 MB
> Total Page File = 3947 MB
> Available Page File = 2046 MB
> Total Virtual = 2047 MB
> Available Virtual = 93 MB
> ***Stack Dump being sent to C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\LOG\SQLDump0002.txt
> SqlDumpExceptionHandler: Process 70 generated fatal exception c0000005
> EXCEPTION_ACCESS_VIOLATION. SQL Server is
> terminating this process.
> *
> ****************************************
**********************************
*****
> *
> * BEGIN STACK DUMP:
> * 07/20/06 20:26:18 spid 70
> *
> *
> * Exception Address = 7C8224B2 Module(ntdll+000224B2)
> * Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
> * Access Violation occurred reading address 00000003
> * Input Buffer 510 bytes -
> * select a.currencycode, a.glmasterno, a.loanrefno, a.customerid, a.contr
a
> * cttype, a.NewLoanBaln, a.TtlAccrueInt, substring(b.duedate,5,2) + '/' +
> * substring(b.duedate,3,2) + '/' + substring(b.duedate,1,2) as DueDate_Fo
x
> * Pro, b.* from eximbills_drawfm00 a right join (select I.*, P.schedule
p
> * rincipal as MerchedPrincipal, P.penaltotalinterest as Ppenality from (s
e
> * lect * from (Select *, case when left(duedate,2) > '78' then '19' +
d
> * uedate else '20' + duedate end as modi_duedate from eximbills_drawfpsf
w
> * here right(kpsfkey,1) = 'I') z where modi_duedate between '20060603'
a
> * nd '20060803' and payoutflag <> 'Y') I join (select scheduleprincipa
l
> * , kpsfkey, penaltotalinterest from (Select *, case when left(duedate
,
> * 2) > '78' then '19' + duedate else '20' + duedate end as modi_duedate f
r
> * om eximbills_drawfpsf where right(kpsfkey,1) = 'P') x where modi_dued
a
> * te between '20060603' and '20060803' and payoutflag <> 'Y') P on l
e
> * ft(I.kpsfkey,25) = left(P.kpsfkey,25)) b on rtrim(ltrim(a.loanrefno)) =
> * substring(b.kpsfkey,1,12) where rtrim(ltrim(a.recordtype)) <> '009' o
r
> * der by loanrefno, kpsfkey
>
> ****************SQLDUMPER_ERRORLOG******
********
> 07/20/06 20:24:58, ERROR , SQLDUMPER_UNKNOWN_APP.EXE, AdjustTokenPrivilege
s
> () failed (00000514)
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Input parameters: 4
> supplied
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ProcessID = 1744
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ThreadId = 0
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Flags = 0x0
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDumpFlags =
0x0
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, SqlInfoPtr =
> 0x02A03570
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, DumpDir = <NULL>
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExceptionRecordP
tr
> = 0x00000000
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ContextPtr =
> 0x00000000
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ExtraFile = <NUL
L>
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, InstanceName =
> <NULL>
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, ServiceName = <N
ULL>
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Dump is associated
> with file C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\LOG\SQLDump0001.txt
> 07/20/06 20:24:58, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 11 not
> used
> 07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, Callback type 7 not
used
> 07/20/06 20:25:03, ACTION, SQLDUMPER_UNKNOWN_APP.EXE, MiniDump completed:
> C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLDump0001.mdmp
> 07/20/06 20:25:03, ACTION, sqlservr.exe, Watson Invoke: No|||The query is working fine with running in query analyzer and there is no
error in dbcc checkdb. I found that there was an error in event viewer about
fatal exception with win32 or c++ when the MSSQL2005 stopped unexpectedly.
SQL Server is terminating because of fatal exception c0000005. This error
may be caused by an unhandled Win32 or C++ exception, or by an access
violation encountered during exception handling. Check the SQL error log for
any related stack dumps or messages. This exception forces SQL Server to
shutdown. To recover from this error, restart the server (unless SQLAgent is
configured to auto restart).
Thanks in advance!
"John Bell" wrote:
[vbcol=seagreen]
> Hi stephanie
> Have you run this query successfully from query analyser? Have you run DBC
C
> CHECKDB and made sure that there are no hardware errors or other errors
> reported in the event log?
> You may want to look at re-writing the query. It is best not not use SELEC
T
> * in production code as you will be selecting more than you are using. Pos
t
> DDL and sample data with the expected output from that data if you need he
lp
> re-writing this see http://www.aspfaq.com/etiquette.asp?id=5006
> John
> "stephanie" wrote:
>|||Hi Stephanie
There are a couple of issues logged at:
https://connect.microsoft.com/SQLSe...0
000005
they mainly seem to be the 64 bit version. You could try the post SP1 hotfix
on a test server http://support.microsoft.com/Kb/918222 is publically
available and there are others available from PSS see
[url]http://www.sqlsecurity.com/FAQs/SQLServerVersionDatabase/tabid/63/Default.aspx[/ur
l]
I think the issue may be related to the complexity of the query, so you may
want to try and re-write it or reduce it to find the point when it fails.
You may also want to raise a call with PSS and pass on any dump files that
you have.
John
"stephanie" wrote:
[vbcol=seagreen]
> The query is working fine with running in query analyzer and there is no
> error in dbcc checkdb. I found that there was an error in event viewer abo
ut
> fatal exception with win32 or c++ when the MSSQL2005 stopped unexpectedly.
> SQL Server is terminating because of fatal exception c0000005. This error
> may be caused by an unhandled Win32 or C++ exception, or by an access
> violation encountered during exception handling. Check the SQL error log f
or
> any related stack dumps or messages. This exception forces SQL Server to
> shutdown. To recover from this error, restart the server (unless SQLAgent
is
> configured to auto restart).
>
> Thanks in advance!
> "John Bell" wrote:
>
Friday, March 9, 2012
Faster SQL query
I M basically an application developer & use simple sql queries in my programmings. I do not have much idea abt tuning/auditing part & thatswhy i m unable to answer them properly in my interviews. Can anybody give me some tips???
Question 1:
In a stored procedure, One SELECT stmt is there & depending upon the @.rowcount, it updates around 14000 records which is also written inside this stored procedure. Instead of writing this way, there is some other way which is faster than this. Can anybody tell me the correct way?
Question 2:Can anybody give me few examples like this?? I need them desparetly.
Thanx. Bye.::I M basically an application developer & use simple sql queries in my programmings. I do
::not have much idea abt tuning/auditing part & thatswhy i m unable to answer them
::properly in my interviews. Can anybody give me some tips???
Get a good beginner book into SQL, like "SQL for Dummies" (no pun intended, the dummies books are nowmally very nice).
::In a stored procedure, One SELECT stmt is there & depending upon the @.rowcount, it
::updates around 14000 records which is also written inside this stored procedure. Instead of
::writing this way, there is some other way which is faster than this. Can anybody tell me the
::correct way?
No. Because you do not give enough information to advice on a better way.
::Question 2:Can anybody give me few examples like this?? I need them desparetly.
I really suggest some introductory books about how SQL works. Simple queries do not cut it.|||Let me give the skeleton of the store proc:
select * from tab1
if @.rowcount>1
update table2 set col1="asadsasasa"
end if
That person was asking me "by updating 40000 records in this manner, it will be quite slow". So, what is the faster way?
thanx for ur advice... i w'll go thru one such book.
Bye.|||Another rubbish question, the original question that is. What does "updating 40K records" mean? Are they saying you'd call this proc 40K times? I assume they're talking about an update with a join, but the question is just awful. The proc shown here would always just update the same thing so an update join would be no better? Madness!|||::That person was asking me "by updating 40000 records in this manner, it will be quite
::slow". So, what is the faster way?
The issue is the
::select * from tab1
which retrieves the rows.
a better way is along the lines
select count(*) from tab1 (hm, how do syou select into a variable- i Havenot done sp's for more than a year)
if (variable) > 1
the select count(*) does not retrieve the values.
You should really get:
* SQL for dummies
THEN
SQL for Smarties from Joe Celko|||Well done thona for translating the question! If you're right then you'd be better of with an "exists"
If exists(select * from tab1)
update table2 set col1="asadsasasa"
Although I still think the wording of "update 40000..." is mighty odd.|||::If you're right then you'd be better of with an "exists"
Yes, I realized this, too, once it was posted.
Bout someone else was right - the original question is not formulated good.|||Thanx everybody & extremely sorry for these type of questions. But hope u all understand my problem. Actually all these questions are asked by somebodyelse. So, thanx for ur cooperation.
Yes, Exists & Count are better option for the "SELECT" stmt. But he was stressing more on the "UPDATE" stmt which is updating 14K records after getting the @.ROWCOUNT.
SO KINDLY COOPERATE AGAIN.
THNX EVERYBODY.|||If you really want to change the same col in 40K records there really isn't much else you can do. Perhaps turn off the indexing and put it back at the end or something but I think that's reaching a bit. If that represented the entire table then I 'spose you could argue that truncating the table and then inserting might be a tad quicker but again that sounds a mighty complicated answer for such a strange question. Plus you'd get into trouble if you wanted to rollback. Are you sure there isn't something missing from the original question?|||Hi PKR!
thnx for ur cooperation. There is no other clue for u/me. He was only stressing on that point only.(i.e. updating 14k records in this manner will take lot of time).
Do u have any idea abt the followings:
1. Is there any possibility to fire a trigger for updation?
2. Is a nested stored proc will be a better option?
Thanx again.
Waiting for reply...|||I already said once, I repeast it now:
get an introducotry book into SQL. Most of your questions are simply a result of not really having a deep understanding of the language. You need to get into set oriented mood to achieve anything in SQL in a fast way.
::1. Is there any possibility to fire a trigger for updation?
Did you look at the documentation of the CRATE TRIGGER statement? It would answer this question in less time than posting.
::2. Is a nested stored proc will be a better option?
This sentence makes no sense grammar wise, sadly.
Nested SP's should be used when necessary. Calling a nested SP instead of making a set operation is a beginner error, though - a proper SQL Server (count oracle out of this for certain things) works SET oriented. Replacing a set command with a nested SP called in a loop is NOT a good way to achieve something.|||Hi!
Sorry ... & thanx for ur valuable advice. I'll do as u said.
Bye|||Hello Thomas!
Sorry for disturbing u again. AS per ur advice, i went thru the fundas.
It seems that fellow wanted to ask me the alternative of "Runtime Query Handling" in a stored proc. As it will be slow if we use the runtime queries ....
So, cud u pls. tell me if any alternative approach is there. I think only alternative approach is to do these things in our application program instead of stored proc.
Kindly advice.
Reagrds,
Lita.|||::It seems that fellow wanted to ask me the alternative of "Runtime Query Handling" in a
::stored proc.
Alternative of WHAT?
Puting three terms noone knows besides you into paranthesis does not make it common knowledge.
What do you mean?|||Interesting that neither "Run-time Query Handling" nor "Runtime Query Handling" return a single hit from Google. Sounds like an interviewer who doesn't have a clue and is trying to throw a curve.