Showing posts with label below. Show all posts
Showing posts with label below. Show all posts

Friday, March 30, 2012

running and exporting report using visual basic 6.0 (not using .net)

Hello,
I saw the post below that it is possible if we develop programs with C# or
VB.NET.
My question is
Is it possible to develop the program using visual basic 6.0?
If so, which reporting services dll should be referenced in visual basic 6.0
project?
Could you explain in detail what to do in visual studio IDE environment?
Thanks in advance,
StpnK
<<copied from the previous posts>>
>Yes, Reporting Services provide a set of Web Services API that you can call
>to generate report. Form your client app project (Win Form App), set web
>reference to the reporting services and look into its Render() methods. You
>can also learn more aboubt this from SQL Server2005 Book on Line.
>
"Smugliy" <Smugliy@.discussions.microsoft.com> wrote in message
news:184E2D63-E618-4C35-A0C5-5F3A647B3803@.microsoft.com...
> Hello ,All
> I am new to the reporting services and my question maybe stupid .
>
> I created some report and published it on the server.
> Now my question is : does it possible at all to run this report from my
> client (in C# )and to export the result to CSV format also from client
> Is there any web service that I can use which is calling for my report
> ?
> Please ,help me to understand this .
> Thanks a lot.
> Smugliy
>
>
>You would have to use the soap toolkit and do lots and lots of roll your own
coding. And even then there might be some incompatibilities.
Your best bet is to use URL integration. This is very straight forward and
easy to implement. Generate the URL string, embed the IE browser control (if
all you want to do is show the report) and set the url for the control.
There are lots of examples on the web of how to embed the browser control
and set the URL.
Books online has lots of examples of URL integration.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"stpnK" <ssdfatepano917@.optonline.net> wrote in message
news:47f3122d$0$15166$607ed4bc@.cv.net...
> Hello,
> I saw the post below that it is possible if we develop programs with C# or
> VB.NET.
> My question is
> Is it possible to develop the program using visual basic 6.0?
> If so, which reporting services dll should be referenced in visual basic
> 6.0 project?
> Could you explain in detail what to do in visual studio IDE environment?
> Thanks in advance,
> StpnK
> <<copied from the previous posts>>
>>Yes, Reporting Services provide a set of Web Services API that you can
>>call
>>to generate report. Form your client app project (Win Form App), set web
>>reference to the reporting services and look into its Render() methods.
>>You
>>can also learn more aboubt this from SQL Server2005 Book on Line.
> "Smugliy" <Smugliy@.discussions.microsoft.com> wrote in message
> news:184E2D63-E618-4C35-A0C5-5F3A647B3803@.microsoft.com...
>> Hello ,All
>> I am new to the reporting services and my question maybe stupid .
>> I created some report and published it on the server.
>> Now my question is : does it possible at all to run this report from my
>> client (in C# )and to export the result to CSV format also from client
>> Is there any web service that I can use which is calling for my report
>> ?
>> Please ,help me to understand this .
>> Thanks a lot.
>> Smugliy
>>
>
>|||Thanks for your reply. Bruce.
Let me explain details.
I have a VB6 program (A.EXE) keeping running on the server. This program
should do lots of things such as monitoring the incoming files, reading the
files and do various kinds of tasks depending on the file type and other
conditions on the file...
With certain type of files, this program needs to call report-generator
(dll) (this is the program I want to write) of SSRS 2005 (passing
parameters) so that the report-generator saves the output file as PDF format
on the network folder. After that this program picks up this PDF file and
send emails to the customer with PDF reports attachments.
So to speak, there is no user interaction, no report viewer required...
(1) Is it doable with vb6.0 projects (possibly connecting to SSRS without
user interaction)?
If so, can you tell me the sample URL site? or attach the sample?
(2) I think it is doable with C#.NET or VB.NET...
Can you introduce the URL of samples? Or attach the sample if you have any?
Best Regards,
stpnK
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:ul0WYuNlIHA.1184@.TK2MSFTNGP04.phx.gbl...
> You would have to use the soap toolkit and do lots and lots of roll your
> own coding. And even then there might be some incompatibilities.
> Your best bet is to use URL integration. This is very straight forward and
> easy to implement. Generate the URL string, embed the IE browser control
> (if all you want to do is show the report) and set the url for the
> control. There are lots of examples on the web of how to embed the browser
> control and set the URL.
> Books online has lots of examples of URL integration.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "stpnK" <ssdfatepano917@.optonline.net> wrote in message
> news:47f3122d$0$15166$607ed4bc@.cv.net...
>> Hello,
>> I saw the post below that it is possible if we develop programs with C#
>> or VB.NET.
>> My question is
>> Is it possible to develop the program using visual basic 6.0?
>> If so, which reporting services dll should be referenced in visual basic
>> 6.0 project?
>> Could you explain in detail what to do in visual studio IDE environment?
>> Thanks in advance,
>> StpnK
>> <<copied from the previous posts>>
>>Yes, Reporting Services provide a set of Web Services API that you can
>>call
>>to generate report. Form your client app project (Win Form App), set web
>>reference to the reporting services and look into its Render() methods.
>>You
>>can also learn more aboubt this from SQL Server2005 Book on Line.
>>
>> "Smugliy" <Smugliy@.discussions.microsoft.com> wrote in message
>> news:184E2D63-E618-4C35-A0C5-5F3A647B3803@.microsoft.com...
>> Hello ,All
>> I am new to the reporting services and my question maybe stupid .
>> I created some report and published it on the server.
>> Now my question is : does it possible at all to run this report from my
>> client (in C# )and to export the result to CSV format also from client
>> Is there any web service that I can use which is calling for my report
>> ?
>> Please ,help me to understand this .
>> Thanks a lot.
>> Smugliy
>>
>>
>>
>|||I use the URL method in two ways. One, I have used it for integrating in old
type of programs. For instance, we use In-Touch a real time MMI (in the real
time control world the environment that interacts with the user is called
MMI, man machine interface). For that I embed a browser control. However, in
your case you have no GUI and so you would need to go to a lower level,
getting some dll that will go to a website and then get the stream back and
do with it as you will. Personally I think this is going to be a mess.
I think a vb.net or c# program using web services would be a much better way
to go that using URL and VB6.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"stpnK" <ssdfatepano917@.optonline.net> wrote in message
news:47f6b3df$0$15199$607ed4bc@.cv.net...
> Thanks for your reply. Bruce.
> Let me explain details.
> I have a VB6 program (A.EXE) keeping running on the server. This program
> should do lots of things such as monitoring the incoming files, reading
> the
> files and do various kinds of tasks depending on the file type and other
> conditions on the file...
> With certain type of files, this program needs to call report-generator
> (dll) (this is the program I want to write) of SSRS 2005 (passing
> parameters) so that the report-generator saves the output file as PDF
> format
> on the network folder. After that this program picks up this PDF file and
> send emails to the customer with PDF reports attachments.
> So to speak, there is no user interaction, no report viewer required...
> (1) Is it doable with vb6.0 projects (possibly connecting to SSRS without
> user interaction)?
> If so, can you tell me the sample URL site? or attach the sample?
> (2) I think it is doable with C#.NET or VB.NET...
> Can you introduce the URL of samples? Or attach the sample if you have
> any?
> Best Regards,
> stpnK
>
> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
> news:ul0WYuNlIHA.1184@.TK2MSFTNGP04.phx.gbl...
>> You would have to use the soap toolkit and do lots and lots of roll your
>> own coding. And even then there might be some incompatibilities.
>> Your best bet is to use URL integration. This is very straight forward
>> and easy to implement. Generate the URL string, embed the IE browser
>> control (if all you want to do is show the report) and set the url for
>> the control. There are lots of examples on the web of how to embed the
>> browser control and set the URL.
>> Books online has lots of examples of URL integration.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "stpnK" <ssdfatepano917@.optonline.net> wrote in message
>> news:47f3122d$0$15166$607ed4bc@.cv.net...
>> Hello,
>> I saw the post below that it is possible if we develop programs with C#
>> or VB.NET.
>> My question is
>> Is it possible to develop the program using visual basic 6.0?
>> If so, which reporting services dll should be referenced in visual basic
>> 6.0 project?
>> Could you explain in detail what to do in visual studio IDE environment?
>> Thanks in advance,
>> StpnK
>> <<copied from the previous posts>>
>>Yes, Reporting Services provide a set of Web Services API that you can
>>call
>>to generate report. Form your client app project (Win Form App), set web
>>reference to the reporting services and look into its Render() methods.
>>You
>>can also learn more aboubt this from SQL Server2005 Book on Line.
>>
>> "Smugliy" <Smugliy@.discussions.microsoft.com> wrote in message
>> news:184E2D63-E618-4C35-A0C5-5F3A647B3803@.microsoft.com...
>> Hello ,All
>> I am new to the reporting services and my question maybe stupid .
>> I created some report and published it on the server.
>> Now my question is : does it possible at all to run this report from my
>> client (in C# )and to export the result to CSV format also from client
>> Is there any web service that I can use which is calling for my
>> report
>> ?
>> Please ,help me to understand this .
>> Thanks a lot.
>> Smugliy
>>
>>
>>
>>
>

Running an INSERT statement a @variable without using EXEC

The Code-Piece below does not work because @.Tablename is not an objekt.

=============================================

DECLARE @.Tablename varchar(256)

set @.Tablename = 'MyTable'

insert into @.Tablename default values

=============================================

How can i make it work without using EXEC?

Thanks in advance

Raimund

You have to use dynamic SQL (which is what I presume you mean by using EXEC). I don't think there is any other way.|||If I use scope_identity with an insert-statement by dynamic SQL, scope_identity reurns NULL;|||

If you put the Scope_identity call into the dynamic sql you will be able to capture it to a variable. That variable can then be returned if you use the sp_executesql form of dynamic sql.

|||

You need to call the identity in the dynamic SQL

declare @.tablename varchar(100)

declare @.sql nvarchar(1000)

declare @.i int

set @.tablename = 'mytable'

set @.sql = 'insert into ' + @.tablename + ' default values

set @.i = scope_identity()'

exec sp_executesql @.sql, N'@.i int output', @.i output

select @.i

|||This does mean you can put this code in a UDF|||

Ok. It works fine.

Thanks.

Best Regards

Raimund

Wednesday, March 21, 2012

Run trace script

Hi All,
I really need help to fix this issue. Below is what I am trying to do.
I created a trace template and script it out to be a SQL script file. I
want to run this script when CPU utilizes at over 50 or 60 or higher. I
set up an System Moniter Alert to run this script when CPU runs meet
above threshold. However, when I manipulated data in Query Analyzer to
make CPU utilize at 100% but trace script never get kick off.
The ideal task is, I wanted to capture what is running on my box when
CPU runs at 50% or higher.
Please let me know and provide me any instructions on what I'm missing.
Thanks,
Silaphet,What's the interval for sampling the perofmance data, in your alert? Could
it be that when the alert is checking the CPU utilisation, the CPU was not
really running above the threshold?
How is the alert supposed to invoke the trace? Are you using a OSQL?
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108700587.482182.134100@.l41g2000cwc.googlegroups.com...
Hi All,
I really need help to fix this issue. Below is what I am trying to do.
I created a trace template and script it out to be a SQL script file. I
want to run this script when CPU utilizes at over 50 or 60 or higher. I
set up an System Moniter Alert to run this script when CPU runs meet
above threshold. However, when I manipulated data in Query Analyzer to
make CPU utilize at 100% but trace script never get kick off.
The ideal task is, I wanted to capture what is running on my box when
CPU runs at 50% or higher.
Please let me know and provide me any instructions on what I'm missing.
Thanks,
Silaphet,|||Hi Vyas,
The interval was 2 for sampling data and the unit was seconds. While
the alert was running, I manipulated data to insert into a table in
millions rows from Query Analyzer. At that time, I watched the CPU and
it was 100% for at least 5 seconds to complete. I though, when CPU ran
over the threshold the alert should kick off the trace script file to
capture the SQL statements that I inserted data into table as I
explained above.
In the alert, there is a tab called "ACTION" and has option check box
says 'run this program'. I checked this option with valid path where I
store my strace script file.
Do I need to convert my trace script SQL file to be cmd or executable
file before alert can kick it of?
Please let me know what do I have to do to remedy this issue.
Thanks,
Silaphet,|||You mean, you provided a path to your .sql file where your sql commands are
stored? Then it will not work. See OSQL in SQL Server Books Online. It can
take your script file and server details as parameters and run your script
against the specified server.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108736989.524985.277180@.l41g2000cwc.googlegroups.com...
Hi Vyas,
The interval was 2 for sampling data and the unit was seconds. While
the alert was running, I manipulated data to insert into a table in
millions rows from Query Analyzer. At that time, I watched the CPU and
it was 100% for at least 5 seconds to complete. I though, when CPU ran
over the threshold the alert should kick off the trace script file to
capture the SQL statements that I inserted data into table as I
explained above.
In the alert, there is a tab called "ACTION" and has option check box
says 'run this program'. I checked this option with valid path where I
store my strace script file.
Do I need to convert my trace script SQL file to be cmd or executable
file before alert can kick it of?
Please let me know what do I have to do to remedy this issue.
Thanks,
Silaphet,|||Vyas,
Let me explain to you clearly now. I have 2 files name below:
1. RunOSQL.SQL
This file has this OSQL syntax below
"OSQL -Sserver\Instance -Usa -Ppassword -iInputfile
The RunOSQL.SQL file is the file I provide the with a valid path on
the Action tab of alert.
2. The input file is the file to create trace when CPU utilization hits
over threshold
Both these files are located in C drive.
But when I inserted millions rows into a temp table the CPU ran at 100%
and the script never get executed. I think, I have to make this SQL
script to be a cmd, exe or bat file before it can call another script
to get executed.
Please let me know what I am missing now.
Thanks,
Silaphet,|||Name the file containing the OSQL.EXE call as a .BAT file. For example,
RunScript.bat
--
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108751013.930610.13850@.c13g2000cwb.googlegroups.com...
> Vyas,
> Let me explain to you clearly now. I have 2 files name below:
> 1. RunOSQL.SQL
> This file has this OSQL syntax below
> "OSQL -Sserver\Instance -Usa -Ppassword -iInputfile
> The RunOSQL.SQL file is the file I provide the with a valid path on
> the Action tab of alert.
> 2. The input file is the file to create trace when CPU utilization hits
> over threshold
> Both these files are located in C drive.
> But when I inserted millions rows into a temp table the CPU ran at 100%
> and the script never get executed. I think, I have to make this SQL
> script to be a cmd, exe or bat file before it can call another script
> to get executed.
>
> Please let me know what I am missing now.
> Thanks,
> Silaphet,
>

Run trace script

Hi All,
I really need help to fix this issue. Below is what I am trying to do.
I created a trace template and script it out to be a SQL script file. I
want to run this script when CPU utilizes at over 50 or 60 or higher. I
set up an System Moniter Alert to run this script when CPU runs meet
above threshold. However, when I manipulated data in Query Analyzer to
make CPU utilize at 100% but trace script never get kick off.
The ideal task is, I wanted to capture what is running on my box when
CPU runs at 50% or higher.
Please let me know and provide me any instructions on what I'm missing.
Thanks,
Silaphet,
What's the interval for sampling the perofmance data, in your alert? Could
it be that when the alert is checking the CPU utilisation, the CPU was not
really running above the threshold?
How is the alert supposed to invoke the trace? Are you using a OSQL?
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108700587.482182.134100@.l41g2000cwc.googlegr oups.com...
Hi All,
I really need help to fix this issue. Below is what I am trying to do.
I created a trace template and script it out to be a SQL script file. I
want to run this script when CPU utilizes at over 50 or 60 or higher. I
set up an System Moniter Alert to run this script when CPU runs meet
above threshold. However, when I manipulated data in Query Analyzer to
make CPU utilize at 100% but trace script never get kick off.
The ideal task is, I wanted to capture what is running on my box when
CPU runs at 50% or higher.
Please let me know and provide me any instructions on what I'm missing.
Thanks,
Silaphet,
|||Hi Vyas,
The interval was 2 for sampling data and the unit was seconds. While
the alert was running, I manipulated data to insert into a table in
millions rows from Query Analyzer. At that time, I watched the CPU and
it was 100% for at least 5 seconds to complete. I though, when CPU ran
over the threshold the alert should kick off the trace script file to
capture the SQL statements that I inserted data into table as I
explained above.
In the alert, there is a tab called "ACTION" and has option check box
says 'run this program'. I checked this option with valid path where I
store my strace script file.
Do I need to convert my trace script SQL file to be cmd or executable
file before alert can kick it of?
Please let me know what do I have to do to remedy this issue.
Thanks,
Silaphet,
|||You mean, you provided a path to your .sql file where your sql commands are
stored? Then it will not work. See OSQL in SQL Server Books Online. It can
take your script file and server details as parameters and run your script
against the specified server.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108736989.524985.277180@.l41g2000cwc.googlegr oups.com...
Hi Vyas,
The interval was 2 for sampling data and the unit was seconds. While
the alert was running, I manipulated data to insert into a table in
millions rows from Query Analyzer. At that time, I watched the CPU and
it was 100% for at least 5 seconds to complete. I though, when CPU ran
over the threshold the alert should kick off the trace script file to
capture the SQL statements that I inserted data into table as I
explained above.
In the alert, there is a tab called "ACTION" and has option check box
says 'run this program'. I checked this option with valid path where I
store my strace script file.
Do I need to convert my trace script SQL file to be cmd or executable
file before alert can kick it of?
Please let me know what do I have to do to remedy this issue.
Thanks,
Silaphet,
|||Vyas,
Let me explain to you clearly now. I have 2 files name below:
1. RunOSQL.SQL
This file has this OSQL syntax below
"OSQL -Sserver\Instance -Usa -Ppassword -iInputfile
The RunOSQL.SQL file is the file I provide the with a valid path on
the Action tab of alert.
2. The input file is the file to create trace when CPU utilization hits
over threshold
Both these files are located in C drive.
But when I inserted millions rows into a temp table the CPU ran at 100%
and the script never get executed. I think, I have to make this SQL
script to be a cmd, exe or bat file before it can call another script
to get executed.
Please let me know what I am missing now.
Thanks,
Silaphet,
|||Name the file containing the OSQL.EXE call as a .BAT file. For example,
RunScript.bat
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108751013.930610.13850@.c13g2000cwb.googlegro ups.com...
> Vyas,
> Let me explain to you clearly now. I have 2 files name below:
> 1. RunOSQL.SQL
> This file has this OSQL syntax below
> "OSQL -Sserver\Instance -Usa -Ppassword -iInputfile
> The RunOSQL.SQL file is the file I provide the with a valid path on
> the Action tab of alert.
> 2. The input file is the file to create trace when CPU utilization hits
> over threshold
> Both these files are located in C drive.
> But when I inserted millions rows into a temp table the CPU ran at 100%
> and the script never get executed. I think, I have to make this SQL
> script to be a cmd, exe or bat file before it can call another script
> to get executed.
>
> Please let me know what I am missing now.
> Thanks,
> Silaphet,
>
sql

Run trace script

Hi All,
I really need help to fix this issue. Below is what I am trying to do.
I created a trace template and script it out to be a SQL script file. I
want to run this script when CPU utilizes at over 50 or 60 or higher. I
set up an System Moniter Alert to run this script when CPU runs meet
above threshold. However, when I manipulated data in Query Analyzer to
make CPU utilize at 100% but trace script never get kick off.
The ideal task is, I wanted to capture what is running on my box when
CPU runs at 50% or higher.
Please let me know and provide me any instructions on what I'm missing.
Thanks,
Silaphet,What's the interval for sampling the perofmance data, in your alert? Could
it be that when the alert is checking the CPU utilisation, the CPU was not
really running above the threshold?
How is the alert supposed to invoke the trace? Are you using a OSQL?
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108700587.482182.134100@.l41g2000cwc.googlegroups.com...
Hi All,
I really need help to fix this issue. Below is what I am trying to do.
I created a trace template and script it out to be a SQL script file. I
want to run this script when CPU utilizes at over 50 or 60 or higher. I
set up an System Moniter Alert to run this script when CPU runs meet
above threshold. However, when I manipulated data in Query Analyzer to
make CPU utilize at 100% but trace script never get kick off.
The ideal task is, I wanted to capture what is running on my box when
CPU runs at 50% or higher.
Please let me know and provide me any instructions on what I'm missing.
Thanks,
Silaphet,|||Hi Vyas,
The interval was 2 for sampling data and the unit was seconds. While
the alert was running, I manipulated data to insert into a table in
millions rows from Query Analyzer. At that time, I watched the CPU and
it was 100% for at least 5 seconds to complete. I though, when CPU ran
over the threshold the alert should kick off the trace script file to
capture the SQL statements that I inserted data into table as I
explained above.
In the alert, there is a tab called "ACTION" and has option check box
says 'run this program'. I checked this option with valid path where I
store my strace script file.
Do I need to convert my trace script SQL file to be cmd or executable
file before alert can kick it of?
Please let me know what do I have to do to remedy this issue.
Thanks,
Silaphet,|||You mean, you provided a path to your .sql file where your sql commands are
stored? Then it will not work. See OSQL in SQL Server Books Online. It can
take your script file and server details as parameters and run your script
against the specified server.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108736989.524985.277180@.l41g2000cwc.googlegroups.com...
Hi Vyas,
The interval was 2 for sampling data and the unit was seconds. While
the alert was running, I manipulated data to insert into a table in
millions rows from Query Analyzer. At that time, I watched the CPU and
it was 100% for at least 5 seconds to complete. I though, when CPU ran
over the threshold the alert should kick off the trace script file to
capture the SQL statements that I inserted data into table as I
explained above.
In the alert, there is a tab called "ACTION" and has option check box
says 'run this program'. I checked this option with valid path where I
store my strace script file.
Do I need to convert my trace script SQL file to be cmd or executable
file before alert can kick it of?
Please let me know what do I have to do to remedy this issue.
Thanks,
Silaphet,|||Vyas,
Let me explain to you clearly now. I have 2 files name below:
1. RunOSQL.SQL
This file has this OSQL syntax below
"OSQL -Sserver\Instance -Usa -Ppassword -iInputfile
The RunOSQL.SQL file is the file I provide the with a valid path on
the Action tab of alert.
2. The input file is the file to create trace when CPU utilization hits
over threshold
Both these files are located in C drive.
But when I inserted millions rows into a temp table the CPU ran at 100%
and the script never get executed. I think, I have to make this SQL
script to be a cmd, exe or bat file before it can call another script
to get executed.
Please let me know what I am missing now.
Thanks,
Silaphet,|||Name the file containing the OSQL.EXE call as a .BAT file. For example,
RunScript.bat
--
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108751013.930610.13850@.c13g2000cwb.googlegroups.com...
> Vyas,
> Let me explain to you clearly now. I have 2 files name below:
> 1. RunOSQL.SQL
> This file has this OSQL syntax below
> "OSQL -Sserver\Instance -Usa -Ppassword -iInputfile
> The RunOSQL.SQL file is the file I provide the with a valid path on
> the Action tab of alert.
> 2. The input file is the file to create trace when CPU utilization hits
> over threshold
> Both these files are located in C drive.
> But when I inserted millions rows into a temp table the CPU ran at 100%
> and the script never get executed. I think, I have to make this SQL
> script to be a cmd, exe or bat file before it can call another script
> to get executed.
>
> Please let me know what I am missing now.
> Thanks,
> Silaphet,
>

Friday, March 9, 2012

Run dynamic SQL in debugger, get sql dump

Hi,
One of our developer runs a stored procedure containing dynamic SQL in
T-SQL Debugger. She consistently gets error ( see below ):
SqlDumpExceptionHandler: Process 73 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
If she runs it without debugger, it runs fine. She checks the code many
times and can't find anything wrong in the code. We have no idea what's
wrong.
The server is a SQL Server 2000 (SP3) on a Window 2000 with service pack
4.
Thank you.
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
Did you Google for an answer? I searched for below keywords:
c0000005 EXCEPTION_ACCESS_VIOLATION debug
And got some 100 matches. One plausible is http://support.microsoft.com/default...;EN-US;270061.
If you can't find a KB that applies to you, and you are current on service pack, you need to open a case with
MS, since access violations (etc) are most often bugs in SQL Server.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Yanjie Ren" <yren@.cc3.com> wrote in message news:%23lZEgg3iEHA.396@.TK2MSFTNGP12.phx.gbl...
>
> Hi,
> One of our developer runs a stored procedure containing dynamic SQL in
> T-SQL Debugger. She consistently gets error ( see below ):
> SqlDumpExceptionHandler: Process 73 generated fatal exception c0000005
> EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
> If she runs it without debugger, it runs fine. She checks the code many
> times and can't find anything wrong in the code. We have no idea what's
> wrong.
> The server is a SQL Server 2000 (SP3) on a Window 2000 with service pack
> 4.
> Thank you.
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!

Run dynamic SQL in debugger, get sql dump

Hi,
One of our developer runs a stored procedure containing dynamic SQL in
T-SQL Debugger. She consistently gets error ( see below ):
SqlDumpExceptionHandler: Process 73 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
If she runs it without debugger, it runs fine. She checks the code many
times and can't find anything wrong in the code. We have no idea what's
wrong.
The server is a SQL Server 2000 (SP3) on a Window 2000 with service pack
4.
Thank you.
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!Did you Google for an answer? I searched for below keywords:
c0000005 EXCEPTION_ACCESS_VIOLATION debug
And got some 100 matches. One plausible is px?scid=kb;EN-US;270061." target="_blank">http://support.microsoft.com/defaul...b;EN-US;270061.
If you can't find a KB that applies to you, and you are current on service p
ack, you need to open a case with
MS, since access violations (etc) are most often bugs in SQL Server.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Yanjie Ren" <yren@.cc3.com> wrote in message news:%23lZEgg3iEHA.396@.TK2MSFTNGP12.phx.gbl...[
vbcol=seagreen]
>
> Hi,
> One of our developer runs a stored procedure containing dynamic SQL in
> T-SQL Debugger. She consistently gets error ( see below ):
> SqlDumpExceptionHandler: Process 73 generated fatal exception c0000005
> EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
> If she runs it without debugger, it runs fine. She checks the code many
> times and can't find anything wrong in the code. We have no idea what's
> wrong.
> The server is a SQL Server 2000 (SP3) on a Window 2000 with service pack
> 4.
> Thank you.
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it![/vbcol]

Run dynamic SQL in debugger, get sql dump

Hi,
One of our developer runs a stored procedure containing dynamic SQL in
T-SQL Debugger. She consistently gets error ( see below ):
SqlDumpExceptionHandler: Process 73 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
If she runs it without debugger, it runs fine. She checks the code many
times and can't find anything wrong in the code. We have no idea what's
wrong.
The server is a SQL Server 2000 (SP3) on a Window 2000 with service pack
4.
Thank you.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!If memory serves there was a bug with the debugger where
if you run it from the client machine it would either not
work, or result in an error (sorry can't find the
Microsoft Page).
How I solved this is to run the debugger on the server.
One of the Great Ones, Uri, Narayana, Wayne, Dejan, Tibor,
Dan, Andrew or Adam could probably tell you the reason and
the fix.
Peter
"I favor the Civil Rights Act of 1964 and it must be
enforced at gunpoint if necessary."
Ronald Reagan
>--Original Message--
>
>Hi,
>One of our developer runs a stored procedure containing
dynamic SQL in
>T-SQL Debugger. She consistently gets error ( see below ):
>SqlDumpExceptionHandler: Process 73 generated fatal
exception c0000005
>EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating
this process.
>If she runs it without debugger, it runs fine. She checks
the code many
>times and can't find anything wrong in the code. We have
no idea what's
>wrong.
>The server is a SQL Server 2000 (SP3) on a Window 2000
with service pack
>4.
>Thank you.
>
>*** Sent via Developersdex http://www.developersdex.com
***
>Don't just participate in USENET...get rewarded for it!
>.
>|||and Jacco, certinly must not forget Jacco...
Peter
>--Original Message--
>If memory serves there was a bug with the debugger where
>if you run it from the client machine it would either not
>work, or result in an error (sorry can't find the
>Microsoft Page).
>How I solved this is to run the debugger on the server.
>One of the Great Ones, Uri, Narayana, Wayne, Dejan,
Tibor,
>Dan, Andrew or Adam could probably tell you the reason
and
>the fix.
>Peter
>"I favor the Civil Rights Act of 1964 and it must be
>enforced at gunpoint if necessary."
>Ronald Reagan
>
>
>
>>--Original Message--
>>
>>Hi,
>>One of our developer runs a stored procedure containing
>dynamic SQL in
>>T-SQL Debugger. She consistently gets error ( see
below ):
>>SqlDumpExceptionHandler: Process 73 generated fatal
>exception c0000005
>>EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating
>this process.
>>If she runs it without debugger, it runs fine. She
checks
>the code many
>>times and can't find anything wrong in the code. We have
>no idea what's
>>wrong.
>>The server is a SQL Server 2000 (SP3) on a Window 2000
>with service pack
>>4.
>>Thank you.
>>
>>*** Sent via Developersdex http://www.developersdex.com
>***
>>Don't just participate in USENET...get rewarded for it!
>>.
>.
>|||Did you Google for an answer? I searched for below keywords:
c0000005 EXCEPTION_ACCESS_VIOLATION debug
And got some 100 matches. One plausible is http://support.microsoft.com/default.aspx?scid=kb;EN-US;270061.
If you can't find a KB that applies to you, and you are current on service pack, you need to open a case with
MS, since access violations (etc) are most often bugs in SQL Server.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Yanjie Ren" <yren@.cc3.com> wrote in message news:%23lZEgg3iEHA.396@.TK2MSFTNGP12.phx.gbl...
>
> Hi,
> One of our developer runs a stored procedure containing dynamic SQL in
> T-SQL Debugger. She consistently gets error ( see below ):
> SqlDumpExceptionHandler: Process 73 generated fatal exception c0000005
> EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
> If she runs it without debugger, it runs fine. She checks the code many
> times and can't find anything wrong in the code. We have no idea what's
> wrong.
> The server is a SQL Server 2000 (SP3) on a Window 2000 with service pack
> 4.
> Thank you.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

Saturday, February 25, 2012

Run 2nd SQL in stored proc

I have a stored procedure (see below) that inserts records into a history
table from a source table (PayTotals). After that is successful, I would
like to run a delete statement "DELETE FROM dbo.PayTotals WHERE PaidYr =
@.PaidYr" but only if the previous INSERT is successful. What would I need
to add to the proc below to make that happen? Thanks.
David
CREATE PROCEDURE [mc_inshstPayTotals]
(@.PaidYr [smallint])
AS INSERT INTO dbo.hstPayTotals
([EmployerCaseNumber],
[EmployerMax],
[PayFirst],
[PaySecond],
[PaidYr],
[PaidMo])
SELECT
EmployerCaseNumber,
EmployerMax,
PayFirst,
PaySecond,
PaidYr,
PaidMo
FROM dbo.PayTotals
WHERE PaidYr = @.PaidYr
GOWhat does "successful" mean? If it means exactly one row is inserted:
IF @.@.ROWCOUNT = 1
BEGIN
DELETE ...
END
Otherwise, you'll have to be more specific...
"David Chase" <dlchase@.lifetimeinc.com> wrote in message
news:OdaU4pF8FHA.2616@.TK2MSFTNGP15.phx.gbl...
>I have a stored procedure (see below) that inserts records into a history
>table from a source table (PayTotals). After that is successful, I would
>like to run a delete statement "DELETE FROM dbo.PayTotals WHERE PaidYr =
>@.PaidYr" but only if the previous INSERT is successful. What would I need
>to add to the proc below to make that happen? Thanks.
> David
> CREATE PROCEDURE [mc_inshstPayTotals]
> (@.PaidYr [smallint])
> AS INSERT INTO dbo.hstPayTotals
> ([EmployerCaseNumber],
> [EmployerMax],
> [PayFirst],
> [PaySecond],
> [PaidYr],
> [PaidMo])
> SELECT
> EmployerCaseNumber,
> EmployerMax,
> PayFirst,
> PaySecond,
> PaidYr,
> PaidMo
> FROM dbo.PayTotals
> WHERE PaidYr = @.PaidYr
> GO
>|||The system variable @.@.rowcount will return the number of rows affected (in
this case inserted). Also, there is the variable @.@.error that contains <> 0
in the event of an error.
For example:
insert into ...
if @.@.rowcount > 0
begin
..
end
"David Chase" <dlchase@.lifetimeinc.com> wrote in message
news:OdaU4pF8FHA.2616@.TK2MSFTNGP15.phx.gbl...
>I have a stored procedure (see below) that inserts records into a history
>table from a source table (PayTotals). After that is successful, I would
>like to run a delete statement "DELETE FROM dbo.PayTotals WHERE PaidYr =
>@.PaidYr" but only if the previous INSERT is successful. What would I need
>to add to the proc below to make that happen? Thanks.
> David
> CREATE PROCEDURE [mc_inshstPayTotals]
> (@.PaidYr [smallint])
> AS INSERT INTO dbo.hstPayTotals
> ([EmployerCaseNumber],
> [EmployerMax],
> [PayFirst],
> [PaySecond],
> [PaidYr],
> [PaidMo])
> SELECT
> EmployerCaseNumber,
> EmployerMax,
> PayFirst,
> PaySecond,
> PaidYr,
> PaidMo
> FROM dbo.PayTotals
> WHERE PaidYr = @.PaidYr
> GO
>|||The INSERT will always handle thousands of records, so I would think
that if the @.@.rowcount was > 0 then it worked, correct?
David
*** Sent via Developersdex http://www.examnotes.net ***|||JT,
If there IS an error, won't the @.@.rowcount = 0?
Thanks.
*** Sent via Developersdex http://www.examnotes.net ***|||Yes, I would expect that to be the case.
Just because @.@.error = 0, it doesn't necessarily mean that 0 rows were
inserted, becuase the select query may return no rows or a trigger on
hstPayTotals may rollback the insert. Therefore, you will want to at least
check the status of @.@.rowcount.
"David" <daman@.lifetime.com> wrote in message
news:unZmE0F8FHA.1864@.TK2MSFTNGP12.phx.gbl...
> JT,
> If there IS an error, won't the @.@.rowcount = 0?
> Thanks.
>
> *** Sent via Developersdex http://www.examnotes.net ***|||> The INSERT will always handle thousands of records, so I would think
> that if the @.@.rowcount was > 0 then it worked, correct?
Well, again, just because you inserted a bunch of rows doesn't necessarily
mean they were the right ones. :-)
But yes, if all you care about is that at least one row was inserted, then
checking for a positive @.@.ROWCOUNT should suffice.|||>I have a stored procedure (see below) that inserts records into a history
>table from a source table (PayTotals). After that is successful, I would
>like to run a delete statement "DELETE FROM dbo.PayTotals WHERE PaidYr =
>@.PaidYr" but only if the previous INSERT is successful. What would I need
>to add to the proc below to make that happen? Thanks.
I must be missing something in the midst of all this discussion of
@.@.ROWCOUNT and @.@.ERROR. Perhaps I'm being retarded today, but why not just
do this:
BEGIN TRANSACTION
INSERT stuff
DELETE stuff
COMMIT TRANSACTION
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane|||"Mike Labosh" <mlabosh@.hotmail.com> wrote in message
news:%23kJ4e7G8FHA.2616@.TK2MSFTNGP15.phx.gbl...
> I must be missing something in the midst of all this discussion of
> @.@.ROWCOUNT and @.@.ERROR. Perhaps I'm being retarded today, but why not
> just do this:
> BEGIN TRANSACTION
> INSERT stuff
> DELETE stuff
> COMMIT TRANSACTION
It depends what you want to do if the INSERT fails.
Do you still want to DELETE?
And if the INSERT succedes and the DELETE fails.
Do you still want to Commit the INSERT.
Normally you don't.
So after each one, check @.@.rowcount and @.@.errors and Commit only if both
succede.
Else, Rollback.