Showing posts with label procedure. Show all posts
Showing posts with label procedure. Show all posts

Friday, March 30, 2012

Profiler 2005 issue

Hi!

When I try to run profile 2005 ... as soon as i hit the connect button (authentication dialog) I get this error:

The procedure entry point lstrcpynI could not be located in the dynamic link library MSDART.DLL

any ideas?

Everything is up to date on my system. my configuration:

SQL Server 2000 enterprise (can't wait till next week to get EE for 2005)
WS 2003 w/SP1
.NET 1.1/2.0 (2.0 was installed with SQL 2005)
VS.NET 2003 (going to install 2005 later)

Office 2003 with SP2anyone?

Profiler - details of SP

How can I setup Profiler to track/watch the execution of the lines in a
stored procedure?
It looks like I just see exec sp_DoWork, as TextData.
I want to see the sql statements in the SP and how long they each take.
--
Thanks,
ThomasLLHi,
I am not sure whether this is possible...
But as soon as you have identified the SP thats taking time, why dont
you check the execution plan of that SP instead?
Thomas.LeBlanc@.NoSpam.Com wrote:
> How can I setup Profiler to track/watch the execution of the lines in a
> stored procedure?
> It looks like I just see exec sp_DoWork, as TextData.
> I want to see the sql statements in the SP and how long they each take.
> --
> Thanks,
> ThomasLL|||Hi Thomas
You can trace SP:StmtStarting and SP:StmtCompleted
--
HTH
Kalen Delaney, SQL Server MVP
http://sqlblog.com
"Thomas.LeBlanc@.NoSpam.Com"
<ThomasLeBlancNoSpamCom@.discussions.microsoft.com> wrote in message
news:560746F5-F88B-49A5-9A13-EF873EBDD161@.microsoft.com...
> How can I setup Profiler to track/watch the execution of the lines in a
> stored procedure?
> It looks like I just see exec sp_DoWork, as TextData.
> I want to see the sql statements in the SP and how long they each take.
> --
> Thanks,
> ThomasLL|||That gives me the duration of each Insert, Updaet and Select in the SP?
Thanks Karen, you are a blessing to the SQL Server community
--
Thanks,
Thomas
"Kalen Delaney" wrote:
> Hi Thomas
> You can trace SP:StmtStarting and SP:StmtCompleted
> --
> HTH
> Kalen Delaney, SQL Server MVP
> http://sqlblog.com
>
> "Thomas.LeBlanc@.NoSpam.Com"
> <ThomasLeBlancNoSpamCom@.discussions.microsoft.com> wrote in message
> news:560746F5-F88B-49A5-9A13-EF873EBDD161@.microsoft.com...
> > How can I setup Profiler to track/watch the execution of the lines in a
> > stored procedure?
> >
> > It looks like I just see exec sp_DoWork, as TextData.
> >
> > I want to see the sql statements in the SP and how long they each take.
> > --
> > Thanks,
> > ThomasLL
>
>|||SP:StmtCompleted can give you the duration of each statement in the SP.
Thanks for your kind words. Karen thanks you too. ;-)
--
HTH
Kalen Delaney, SQL Server MVP
http://sqlblog.com
"Thomas.LeBlanc@.NoSpam.Com"
<ThomasLeBlancNoSpamCom@.discussions.microsoft.com> wrote in message
news:CC7D6F54-4DE7-4DE8-B7CC-7904572FDF90@.microsoft.com...
> That gives me the duration of each Insert, Updaet and Select in the SP?
>
> Thanks Karen, you are a blessing to the SQL Server community
> --
> Thanks,
> Thomas
>
> "Kalen Delaney" wrote:
>> Hi Thomas
>> You can trace SP:StmtStarting and SP:StmtCompleted
>> --
>> HTH
>> Kalen Delaney, SQL Server MVP
>> http://sqlblog.com
>>
>> "Thomas.LeBlanc@.NoSpam.Com"
>> <ThomasLeBlancNoSpamCom@.discussions.microsoft.com> wrote in message
>> news:560746F5-F88B-49A5-9A13-EF873EBDD161@.microsoft.com...
>> > How can I setup Profiler to track/watch the execution of the lines in a
>> > stored procedure?
>> >
>> > It looks like I just see exec sp_DoWork, as TextData.
>> >
>> > I want to see the sql statements in the SP and how long they each take.
>> > --
>> > Thanks,
>> > ThomasLL
>>

Wednesday, March 28, 2012

Profiler

I really have never used the SQL Profiler, but I'm trying. I have a stored
procedure which runs just fine in query analyzer returning a few rows.
When I run it from a C# application, it returns "0" in the @.ERETURN_VALUE"
but no rows of data are returned.
I brought up Profiler and I am not really able to make heads or tails out
of this. What values should I select in profiler to see if any rows are
returned to the application?
Thanks in advance for your assistance...In your database exeute
select db_id() and take a note of the result
In the profiler on the filters tab go to the databaseID
equals entry and type in the value you extracted.
In events get rid of security audit and sessions.
Now when you run the profiler you will just trace
interactions with your database - usually that's enough to
find entries.
Run the app and you should see the SP call.
Copy this from the result window and run it in query
analyser (in a transaction if it does updates) and you
should see the problem.
>--Original Message--
>I really have never used the SQL Profiler, but I'm
trying. I have a stored
>procedure which runs just fine in query analyzer
returning a few rows.
>When I run it from a C# application, it returns "0" in
the @.ERETURN_VALUE"
>but no rows of data are returned.
>I brought up Profiler and I am not really able to make
heads or tails out
>of this. What values should I select in profiler to see
if any rows are
>returned to the application?
>
>Thanks in advance for your assistance...
>.
>

Profile / Stored Procedure

Hi,

I have created a Stored Procedure, under Stored procedures section under Enterprise Manager on SQL server 2000.

Could anybody tell me, how and what are the steps to follow to TRACE the procedure , using SQL PROFILER ?

Please advice me !

NicolFrom Enterprise Manager:
-- choose Tools
-- SQL Profiler
-- File
-- New
-- Trace
-- select/enter connection informatin as appropriate (I was able to accept the defaults)
-- press OK
-- click the General tab of the Trace Properties window
-- from the "Template name:" dropdown choose SQLProfilerTSQL_SPs
-- choose RUN
-- do whatever it is you need to do to run your Stored Procedure (from within Query Analyzer or ASP.NET)
-- go back to Profiler and click the red square "stop selected trace" icon
-- review the results

Terri|||Thanks Tmorton,

I got started with checking SP using SQL profiler.. :)

Now I found, I think, I have problem with coding in VB.NET or problem in SP.

Even though, I have given valid Username/Password, RETURNVALUE is always showing zero .

Stored procedure
-------
CREATE PROCEDURE test
(@.username varchar(100),
@.userpwd varchar(200)
)
AS
set nocount on
return (select count(*) as s from employer
WHERE user_name like '%@.username%' and
password ='@.userpwd')

GO

VB.NET Code using SP
--------
CmdCoInfo = New SqlCommand("test", ConVM)
CmdCoInfo.CommandType = CommandType.StoredProcedure
CmdCoInfo.Parameters.Add("@.username", Trim(StrUser))
CmdCoInfo.Parameters.Add("@.userpwd", Trim(StrPass))
Dim paramOut As SqlParameter
paramOut = CmdCoInfo.Parameters.Add("Returnvalue", SqlDbType.Int)
paramOut.Direction = ParameterDirection.ReturnValue
paramOut.Size = 40
' Retrieve the record that matches the username/password
ConVM.Open()
CmdCoInfo.ExecuteNonQuery()

Dim retrr As String
If Not IsDBNull(CmdCoInfo.Parameters("Returnvalue").Value) Then
retrr = (CmdCoInfo.Parameters("Returnvalue").Value)
Else
retrr = "Not know"
End If
Response.Write(retrr)

--------------

Is there problem with SP or VB.net code ?

Please advice !|||The problem is in your stored procedure.

Instead of this:

return (select count(*) as s from employer
WHERE user_name like '%@.username%' and
password ='@.userpwd')
GO

This would be more correct:


DECLARE @.RecordCount integer
select @.RecordCount= count(*) from employer
WHERE user_name like '%'+@.username +'%' and
password =@.userpwd
RETURN @.RecordCount

GO

HOWEVER, ReturnValue is meant to signal back to the calling program whether or not the stored procedure was successful. So you are misusing it to return a COUNT. You should use an Output parameter instead. Add an additional parameter called RecordCount with ParameterDirection of Output. Add the Output parameter to your stored procedure, which will look like this:

CREATE PROCEDURE test
(@.username varchar(100),
@.userpwd varchar(200) ,
@.RecordCount int OUTPUT
)
AS
set nocount on
select @.RecordCount= count(*) from employer
WHERE user_name like '%'+@.username +'%' and
password =@.userpwd
RETURN @.@.ERROR

GO


I haven't tested this code but it should be about right.

Terri|||Terri,

ur 2nd option worked for me. But i didnt understand why I am still getting zero as ReturnValue , when I tried with 1st option(given below), eventhough record exists for that username/pwd.

DECLARE @.RecordCount integer
select @.RecordCount= count(*) from employer
WHERE user_name like '%'+@.username +'%' and
password =@.userpwd
RETURN @.RecordCount
GO

Please advice !|||I used that same stored procedure, and your code modified slightly which executes the procedure and puts the returnvalue into a label and it works as expected:


CmdCoInfo = New SqlCommand("returntest", SqlConnection)
CmdCoInfo.CommandType = CommandType.StoredProcedure
CmdCoInfo.Parameters.Add("@.test1", 1)
Dim paramOut As SqlParameter
paramOut = CmdCoInfo.Parameters.Add("Returnvalue", SqlDbType.Int)
paramOut.Direction = ParameterDirection.ReturnValue
paramOut.Size = 40

SqlConnection.Open()
CmdCoInfo.ExecuteNonQuery()

Label1.Text = CmdCoInfo.Parameters("ReturnValue").Value

Terrisql

Monday, March 26, 2012

Product Search question

I have a search box on my website which is used to search the products database.

I will be using the search text in an SQL stored procedure that uses LIKE statements. The search string could realistically contain any character.

How do I prevent SQL injection when any search string is reasonably feasible? .

supergriff:

How do I prevent SQL injection when any search string is reasonably feasible?

I recommend that you read the weblog entry by Microsoft's Bertrand Le Roy,Please, please, please, learn about injection attacks!|||

Great, so if i'm using stored procedures, rather than string concatenation, this inherently prevents SQL injection? My search function is below:

' Select all ProductsPublicFunction GetAllVisibleProductsBySearchString(ByVal SearchStringAsString)As DataTable
Dim connAs SqlConnection =New SqlConnection(_connectionString)Dim cmdStoredProcedureAsNew SqlCommand("dis_GetAllVisibleProductsBySearchString", conn)

cmdStoredProcedure.CommandType = CommandType.StoredProcedure

cmdStoredProcedure.Parameters.Add(

"@.SearchString", SqlDbType.VarChar, 250).Value = SearchStringDim daAs SqlDataAdapter =New SqlDataAdapter(cmdStoredProcedure)Dim dsAs DataSet =New DataSet()Try

conn.Open()

da.Fill(ds,

"Products")
Catch eAs SqlException
' Handle exception.Finally

conn.Close()

EndTryReturn ds.Tables("Products")EndFunction

Wednesday, March 21, 2012

Processor license

Hello everyone,
What is the procedure of changing a SQL 2000 server to processor mode
from per seat?
Thank you
Alex Anderson
The following is unsupported but you may want to check the
link:
Q:How to change the license mode after SQL2000 setup?
http://www.tkdinesh.com/faq/ans/license.html
-Sue
On Mon, 23 Aug 2004 15:18:14 -0700, "Alex Anderson"
<AAnderson@.Murrieta.org> wrote:

>Hello everyone,
> What is the procedure of changing a SQL 2000 server to processor mode
>from per seat?
>Thank you
>Alex Anderson
>
|||Sue,
Interesting link, however Mode is already set to 0 and I'm running
Windows 2003 Server. Although, contained within the same registry key is a
FlipAllow and I'm not sure what this is used for. Perhaps to allow the
switch between Per device and Processor? I have the licenses for two
processes (just purchased them from Microsoft) and now from what I'm told I
might just have to pay for support to re-license SQL. Go figure...
Thank you
Alex Anderson
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:fe6li09llida0kiqg7tksh26hta255i5de@.4ax.com...
> The following is unsupported but you may want to check the
> link:
> Q:How to change the license mode after SQL2000 setup?
> http://www.tkdinesh.com/faq/ans/license.html
> -Sue
> On Mon, 23 Aug 2004 15:18:14 -0700, "Alex Anderson"
> <AAnderson@.Murrieta.org> wrote:
>
sql

Processor license

Hello everyone,
What is the procedure of changing a SQL 2000 server to processor mode
from per seat?
Thank you
Alex AndersonNo, switching between the licensing models is not
permitted.
>--Original Message--
>Hello everyone,
> What is the procedure of changing a SQL 2000 server
to processor mode
>from per seat?
>Thank you
>Alex Anderson
>
>.
>|||The following is unsupported but you may want to check the
link:
Q:How to change the license mode after SQL2000 setup?
http://www.tkdinesh.com/faq/ans/license.html
-Sue
On Mon, 23 Aug 2004 15:18:14 -0700, "Alex Anderson"
<AAnderson@.Murrieta.org> wrote:
>Hello everyone,
> What is the procedure of changing a SQL 2000 server to processor mode
>from per seat?
>Thank you
>Alex Anderson
>|||Sue,
Interesting link, however Mode is already set to 0 and I'm running
Windows 2003 Server. Although, contained within the same registry key is a
FlipAllow and I'm not sure what this is used for. Perhaps to allow the
switch between Per device and Processor? I have the licenses for two
processes (just purchased them from Microsoft) and now from what I'm told I
might just have to pay for support to re-license SQL. Go figure...
Thank you
Alex Anderson
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:fe6li09llida0kiqg7tksh26hta255i5de@.4ax.com...
> The following is unsupported but you may want to check the
> link:
> Q:How to change the license mode after SQL2000 setup?
> http://www.tkdinesh.com/faq/ans/license.html
> -Sue
> On Mon, 23 Aug 2004 15:18:14 -0700, "Alex Anderson"
> <AAnderson@.Murrieta.org> wrote:
> >Hello everyone,
> >
> > What is the procedure of changing a SQL 2000 server to processor mode
> >from per seat?
> >
> >Thank you
> >Alex Anderson
> >
>

Processor license

Hello everyone,
What is the procedure of changing a SQL 2000 server to processor mode
from per seat?
Thank you
Alex AndersonThe following is unsupported but you may want to check the
link:
Q:How to change the license mode after SQL2000 setup?
http://www.tkdinesh.com/faq/ans/license.html
-Sue
On Mon, 23 Aug 2004 15:18:14 -0700, "Alex Anderson"
<AAnderson@.Murrieta.org> wrote:

>Hello everyone,
> What is the procedure of changing a SQL 2000 server to processor mode
>from per seat?
>Thank you
>Alex Anderson
>|||Sue,
Interesting link, however Mode is already set to 0 and I'm running
Windows 2003 Server. Although, contained within the same registry key is a
FlipAllow and I'm not sure what this is used for. Perhaps to allow the
switch between Per device and Processor? I have the licenses for two
processes (just purchased them from Microsoft) and now from what I'm told I
might just have to pay for support to re-license SQL. Go figure...
Thank you
Alex Anderson
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:fe6li09llida0kiqg7tksh26hta255i5de@.
4ax.com...
> The following is unsupported but you may want to check the
> link:
> Q:How to change the license mode after SQL2000 setup?
> http://www.tkdinesh.com/faq/ans/license.html
> -Sue
> On Mon, 23 Aug 2004 15:18:14 -0700, "Alex Anderson"
> <AAnderson@.Murrieta.org> wrote:
>
>

Tuesday, March 20, 2012

Processing the resultset of another proc from a proc

Is it possible to retrieve the resultset of a stored procedure from another procedure in sql server 2000.
Basically I am calling proc2 from the inside of proc1.
proc2 returns 2 resultsets. I want to process these two resultsets
from within proc1.

If its possible , please provide sample code.

thanks in advance,
Alok.Yes, with temporary tables for instance. But it will be easier if you can convert proc2 to two UDF table functions. Your code will be much clearer and simpler to maintain.

Wednesday, March 7, 2012

Process on Linked Server doesn't stop

Hello,
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. If
the application, that run stored procedure work successfully, then everything
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Server
doesn’t stop itself. It’s continuing executing for eternity and locks other
processes. The only way to stop it – is to kill it. I’ll try to set timeouts
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesn’t
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.
Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.

Process on Linked Server doesn't stop

Hello,
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. If
the application, that run stored procedure work successfully, then everything
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Server
doesnâ't stop itself. Itâ's continuing executing for eternity and locks other
processes. The only way to stop it â' is to kill it. Iâ'll try to set timeouts
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesnâ't
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.

Process on Linked Server doesn't stop

Hello,
I have the same problem with Linked Server. I receive recordset from stored
procedure, which executes inside it stored procedure on the Linked Server. I
f
the application, that run stored procedure work successfully, then everythin
g
is OK, but if there are some troubles (e.g. I close the parent application,
before I get recordset), I have the problem: the process on the Linked Serve
r
doesn’t stop itself. It’s continuing executing for eternity and locks ot
her
processes. The only way to stop it – is to kill it. I’ll try to set time
outs
in the configuration of my application
and Query Timeout in the Server Options of Linked Server, but it doesn’t
help. This problem shows itself only if I work through Linked Server.
Thanks for your help.
Boris.Seems to me that if you were to close the application "unexpectedly", then
it leaves an orphaned transaction which probably would explain the
behaviour you are seeing. You might want to consider making some
application code changes that has some sort of logic on open transactions
from the client end, and to close them on an exit, or some such thing.
HTH!
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.

Monday, February 20, 2012

Process 53 generated fatal exception

Is anyone having problems with text columns once SP3A is installed?
I have a stored procedure that simply updates a text column with changes and
I'm getting what looks like a fatal error in SQL Server. It shows up with
this error posted through JDBC:
53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server
is terminating this process.
I didn't see anything in the MS knowledge base. If we remove sp3a and put o
n sp3, it doesn't happen.Amy,
I would raise a call with Microsoft support. You may be encountering a bug.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Amy Thropp wrote:
> Is anyone having problems with text columns once SP3A is installed?
> I have a stored procedure that simply updates a text column with changes a
nd I'm getting what looks like a fatal error in SQL Server. It shows up wit
h this error posted through JDBC:
> 53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Serv
er is terminating this process.
> I didn't see anything in the MS knowledge base. If we remove sp3a and put on sp3,
it doesn't happen.|||If the KB articles on this issue don't apply to your environment, consider
opening a case with Microsoft PSS. You won't be charged if this is a bug,
which is likely with an AV.
Hope this helps.
Dan Guzman
SQL Server MVP
"Amy Thropp" <AmyThropp@.discussions.microsoft.com> wrote in message
news:8E65B0E2-73CD-472D-8947-03ED80BA3F85@.microsoft.com...
> Is anyone having problems with text columns once SP3A is installed?
> I have a stored procedure that simply updates a text column with changes
and I'm getting what looks like a fatal error in SQL Server. It shows up
with this error posted through JDBC:
> 53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL
Server is terminating this process.
> I didn't see anything in the MS knowledge base. If we remove sp3a and put
on sp3, it doesn't happen.

Process 53 generated fatal exception

Is anyone having problems with text columns once SP3A is installed?
I have a stored procedure that simply updates a text column with changes and I'm getting what looks like a fatal error in SQL Server. It shows up with this error posted through JDBC:
53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
I didn't see anything in the MS knowledge base. If we remove sp3a and put on sp3, it doesn't happen.Amy,
I would raise a call with Microsoft support. You may be encountering a bug.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Amy Thropp wrote:
> Is anyone having problems with text columns once SP3A is installed?
> I have a stored procedure that simply updates a text column with changes and I'm getting what looks like a fatal error in SQL Server. It shows up with this error posted through JDBC:
> 53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
> I didn't see anything in the MS knowledge base. If we remove sp3a and put on sp3, it doesn't happen.|||If the KB articles on this issue don't apply to your environment, consider
opening a case with Microsoft PSS. You won't be charged if this is a bug,
which is likely with an AV.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Amy Thropp" <AmyThropp@.discussions.microsoft.com> wrote in message
news:8E65B0E2-73CD-472D-8947-03ED80BA3F85@.microsoft.com...
> Is anyone having problems with text columns once SP3A is installed?
> I have a stored procedure that simply updates a text column with changes
and I'm getting what looks like a fatal error in SQL Server. It shows up
with this error posted through JDBC:
> 53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL
Server is terminating this process.
> I didn't see anything in the MS knowledge base. If we remove sp3a and put
on sp3, it doesn't happen.

Process 53 generated fatal exception

Is anyone having problems with text columns once SP3A is installed?
I have a stored procedure that simply updates a text column with changes and I'm getting what looks like a fatal error in SQL Server. It shows up with this error posted through JDBC:
53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
I didn't see anything in the MS knowledge base. If we remove sp3a and put on sp3, it doesn't happen.
Amy,
I would raise a call with Microsoft support. You may be encountering a bug.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Amy Thropp wrote:
> Is anyone having problems with text columns once SP3A is installed?
> I have a stored procedure that simply updates a text column with changes and I'm getting what looks like a fatal error in SQL Server. It shows up with this error posted through JDBC:
> 53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
> I didn't see anything in the MS knowledge base. If we remove sp3a and put on sp3, it doesn't happen.
|||If the KB articles on this issue don't apply to your environment, consider
opening a case with Microsoft PSS. You won't be charged if this is a bug,
which is likely with an AV.
Hope this helps.
Dan Guzman
SQL Server MVP
"Amy Thropp" <AmyThropp@.discussions.microsoft.com> wrote in message
news:8E65B0E2-73CD-472D-8947-03ED80BA3F85@.microsoft.com...
> Is anyone having problems with text columns once SP3A is installed?
> I have a stored procedure that simply updates a text column with changes
and I'm getting what looks like a fatal error in SQL Server. It shows up
with this error posted through JDBC:
> 53 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL
Server is terminating this process.
> I didn't see anything in the MS knowledge base. If we remove sp3a and put
on sp3, it doesn't happen.

procedures inside a package

I have 48 procedures sitting in a PL/SQL package. when I execute the package I have to select one procedure at a time to get it executed. What could I do to execute the package once and get all the procedures executed at the same time sequencially.A package is just a bag of routines and stuff, somewhat like a library. You cannot execute a package, only the procedures within it.

You need to write another procedure, or anonymous PL/SQL block, like this:

BEGIN
pkg.proc1;
pkg.proc2;
...
pkg.proc48;
END;
/|||Thank you very much

Procedures

Is there a way to start a stored procedure with a trigger? If so how?
Thanks.Hello,

just call the procedure in the trigger ... or do you mean a time trigger (nothing to do with the trigger object)

Best regards
Manfred Peter
Alligator Company Software GmbH
http://www.alligatorsql.com|||Thats what I wanted to know, if I could call a procedure from a trigger. Thanks.

Procedure/Cursor question about returning results

I'm working on a procedure that needs to cycle through the records of some raw data and combine the the current record with the datetime field of the prior record. I have been able to write a script to do that with cursors and variables but my problem is it returns each record separately. How do I go about getting the procedure to return all the records as one set of data?

To see what I mean, the following script for the Pubs DB returns each pass through the data as a seperate query. Since I can't do a select *, what approach should I take? If you want the actual script, I would be happy to provide it.

DECLARE authors_cursor CURSOR
FOR SELECT * FROM authors
OPEN authors_cursor
FETCH NEXT FROM authors_cursor

WHILE @.@.FETCH_STATUS = 0
begin
FETCH NEXT FROM authors_cursor
end

Close Authors_cursor
deallocate authors_cursor

Thanks in advance

Tony Murunion

If you only need the previous value, the best thing would be to store the previous data in a local variable. I think that is a common approach.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de
|||

Thanks for the reply

The actual script I was working with used local variables to get the data I wanted. I was just stuck with getting the results back in one set instead of one for each record.

I was able to resolve my problem by dumping the data into a table in a function (decided to try that instead of a proc)

Tony

Procedure/cursor question about returning results

I'm working on a procedure that needs to cycle through the records of some
raw data and combine the the current record with the datetime field of the
prior record. I have been able to write a script to do that with cursors
and variables but my problem is it returns each record separately. How do I
go about getting the procedure to return all the records as one set of data?
To see what I mean, the following script for the Pubs DB returns each pass
through the data as a seperate query. Since I can't do a select *, what
approach should I take? If you want the actual script I have so far, I
would be happy to provide it.
DECLARE authors_cursor CURSOR
FOR SELECT * FROM authors
OPEN authors_cursor
FETCH NEXT FROM authors_cursor
WHILE @.@.FETCH_STATUS = 0
begin
FETCH NEXT FROM authors_cursor
end
Close Authors_cursor
deallocate authors_cursor
Thanks in advance
Tony MurunionTony Murnion (remove) wrote:
> I'm working on a procedure that needs to cycle through the records of some
> raw data and combine the the current record with the datetime field of the
> prior record. I have been able to write a script to do that with cursors
> and variables but my problem is it returns each record separately. How do
I
> go about getting the procedure to return all the records as one set of dat
a?
> To see what I mean, the following script for the Pubs DB returns each pass
> through the data as a seperate query. Since I can't do a select *, what
> approach should I take? If you want the actual script I have so far, I
> would be happy to provide it.
> DECLARE authors_cursor CURSOR
> FOR SELECT * FROM authors
> OPEN authors_cursor
> FETCH NEXT FROM authors_cursor
> WHILE @.@.FETCH_STATUS = 0
> begin
> FETCH NEXT FROM authors_cursor
> end
> Close Authors_cursor
> deallocate authors_cursor
> Thanks in advance
> Tony Murunion
Your cursor wouldn't give predictable results anyway because you
haven't specified ORDER BY.
Cursors are rarely a good way to get results out of data. In this case
you can possibly use a query. To take another example from Pubs:
SELECT T1.title_id, T1.title,
T1.pubdate AS current_pubdate,
MAX(T2.pubdate) AS previous_pubdate
FROM titles AS T1
LEFT JOIN titles AS T2
ON T1.pubdate > T2.pubdate
GROUP BY T1.title, T1.title_id, T1.pubdate
ORDER BY current_pubdate, previous_pubdate ;
To do that with a cursor you could insert each row to a table variable
and then SELECT from the variable. Don't forget ORDER BY though!
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Thanks for the reply. I just started looking into the tables option. I'm
fairly new to advanced script writing. I've done a lot of select and
updates over the years but most of my data manipulation\retrieval has been
through Crystal. In this current project, I need to do the manipulaton
before the ending result.
With my cursor testing, I do have the order by clause for just the reasons
you stated. The results I'm getting are valid - I just need them to come
over as one record set. The tables option may do that for me. I was also
just looking at the user definde functions. Since this database I am reading
will be generating a few thousand records a day, what do you think will
ultimately give me the best performance? The join example you gave seems
like it would bog down with larger volumes of data.
I did not mention before but this is on sql 2000
Thanks again.
Tony
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1149798283.293874.324730@.j55g2000cwa.googlegroups.com...
> Tony Murnion (remove) wrote:
> Your cursor wouldn't give predictable results anyway because you
> haven't specified ORDER BY.
> Cursors are rarely a good way to get results out of data. In this case
> you can possibly use a query. To take another example from Pubs:
> SELECT T1.title_id, T1.title,
> T1.pubdate AS current_pubdate,
> MAX(T2.pubdate) AS previous_pubdate
> FROM titles AS T1
> LEFT JOIN titles AS T2
> ON T1.pubdate > T2.pubdate
> GROUP BY T1.title, T1.title_id, T1.pubdate
> ORDER BY current_pubdate, previous_pubdate ;
> To do that with a cursor you could insert each row to a table variable
> and then SELECT from the variable. Don't forget ORDER BY though!
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>

procedure, report parameters

(sql/rs v2K, VS .Net 2003)
I have a problem with several multi-dataset reports. I've got several
single-dataset reports working just fine, but these multi-datasets are
problematic. For example, I have one procedure which works w/out parameters,
just returns a statistics report. I have modified the proc to accept a
parameter. If @.ch =1 , give me the first chunk, if @.ch = 2, give me the 2nd
chunk, etc., all the way thru to @.ch=5. All of them together comprise the
whole report. The proc works just fine in query analyzer, like this:
exec procname 1
exec procname 2
exec procname 3
exec procname 4
exec procname 5
now, in RS, i have created 5 datasets. each with the fields returned by
each procedure invocation. mind you, these aren't actual fields, it's select
this as value, select this as count, select this as volume, etc.
the datasets each are Text command types, the query strings are simply
'procname 1', 'procname 2', etc.
all of them work just fine in the Data tab in VS.
in the layout tab, i've created several tables and dragged/dropped the
fields into each accordingly
in the preview tab, i've got data returned in the top two chunks. WOW! cuz
i have been trying this for a very long time, yesterday i had no data at all,
only column headings, i don't know what i changed, but, now i have data in
two chunks, none in the rest. only column headings.
please, can anybody provide some direction on the right way to wrap the
report(s) around procedures like this? remember, the procedures all all just
statisitcal analysis data...no user input is required. i just need to
deliver nicely via email on a scheduled basis.
-- LynnAnd, when I refresh the report (in Preview tab, VS), sometimes all 5 chunks
are there, as desired...but then, I refresh again, and two are blank. (just
the column headings, no data) then, refresh again, and a different two are
blank.
(by 'chunks', i just mean different sections of the report. this particular
report has five different sections...or 'chunks'. each chunk has a
corresponding dataset)
please advise. this is terribly urgent.
-- Lynn
"Lynn" wrote:
> (sql/rs v2K, VS .Net 2003)
> I have a problem with several multi-dataset reports. I've got several
> single-dataset reports working just fine, but these multi-datasets are
> problematic. For example, I have one procedure which works w/out parameters,
> just returns a statistics report. I have modified the proc to accept a
> parameter. If @.ch =1 , give me the first chunk, if @.ch = 2, give me the 2nd
> chunk, etc., all the way thru to @.ch=5. All of them together comprise the
> whole report. The proc works just fine in query analyzer, like this:
> exec procname 1
> exec procname 2
> exec procname 3
> exec procname 4
> exec procname 5
> now, in RS, i have created 5 datasets. each with the fields returned by
> each procedure invocation. mind you, these aren't actual fields, it's select
> this as value, select this as count, select this as volume, etc.
> the datasets each are Text command types, the query strings are simply
> 'procname 1', 'procname 2', etc.
> all of them work just fine in the Data tab in VS.
> in the layout tab, i've created several tables and dragged/dropped the
> fields into each accordingly
> in the preview tab, i've got data returned in the top two chunks. WOW! cuz
> i have been trying this for a very long time, yesterday i had no data at all,
> only column headings, i don't know what i changed, but, now i have data in
> two chunks, none in the rest. only column headings.
> please, can anybody provide some direction on the right way to wrap the
> report(s) around procedures like this? remember, the procedures all all just
> statisitcal analysis data...no user input is required. i just need to
> deliver nicely via email on a scheduled basis.
> -- Lynn|||You might just be seeing an artifact of the development environment. Report
designer caches data. Look where your .rdl file is and you will see a
.rdl.data file. Delete it and you will be guaranteed that it will query your
database.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Lynn" <Lynn@.discussions.microsoft.com> wrote in message
news:96659649-7A0D-488A-B6AD-C6BDD9A2651F@.microsoft.com...
> And, when I refresh the report (in Preview tab, VS), sometimes all 5
> chunks
> are there, as desired...but then, I refresh again, and two are blank.
> (just
> the column headings, no data) then, refresh again, and a different two
> are
> blank.
> (by 'chunks', i just mean different sections of the report. this
> particular
> report has five different sections...or 'chunks'. each chunk has a
> corresponding dataset)
> please advise. this is terribly urgent.
> -- Lynn
>
> "Lynn" wrote:
>> (sql/rs v2K, VS .Net 2003)
>> I have a problem with several multi-dataset reports. I've got several
>> single-dataset reports working just fine, but these multi-datasets are
>> problematic. For example, I have one procedure which works w/out
>> parameters,
>> just returns a statistics report. I have modified the proc to accept a
>> parameter. If @.ch =1 , give me the first chunk, if @.ch = 2, give me the
>> 2nd
>> chunk, etc., all the way thru to @.ch=5. All of them together comprise
>> the
>> whole report. The proc works just fine in query analyzer, like this:
>> exec procname 1
>> exec procname 2
>> exec procname 3
>> exec procname 4
>> exec procname 5
>> now, in RS, i have created 5 datasets. each with the fields returned by
>> each procedure invocation. mind you, these aren't actual fields, it's
>> select
>> this as value, select this as count, select this as volume, etc.
>> the datasets each are Text command types, the query strings are simply
>> 'procname 1', 'procname 2', etc.
>> all of them work just fine in the Data tab in VS.
>> in the layout tab, i've created several tables and dragged/dropped the
>> fields into each accordingly
>> in the preview tab, i've got data returned in the top two chunks. WOW!
>> cuz
>> i have been trying this for a very long time, yesterday i had no data at
>> all,
>> only column headings, i don't know what i changed, but, now i have data
>> in
>> two chunks, none in the rest. only column headings.
>> please, can anybody provide some direction on the right way to wrap the
>> report(s) around procedures like this? remember, the procedures all all
>> just
>> statisitcal analysis data...no user input is required. i just need to
>> deliver nicely via email on a scheduled basis.
>> -- Lynn|||Hi Bruce. There are no data files there at all. ( I wasn't able to get back
to you sooner, as I had a bit of a family emergency. ) I'm not sure how to
proceed with this. I am looking at the rpt right now through
http://server/reports, it is doing the same thing. First invocation, it had
all chunks of the rpt except for chunk 3. After a refresh, that chunk was
there, too. Two more refreshes, entire resultset is there fine, but then
after another refresh, chunk 4 is now missing/blank.
Another much less urgent question would be subscription scheduling. Can
those things vary at all? Meaning, how can i run it on all production
weekdays, instead of just all weekdays? you know...how do I correctly
account for the holidays?
Please advise.
-- Lynn
"Bruce L-C [MVP]" wrote:
> You might just be seeing an artifact of the development environment. Report
> designer caches data. Look where your .rdl file is and you will see a
> ..rdl.data file. Delete it and you will be guaranteed that it will query your
> database.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Lynn" <Lynn@.discussions.microsoft.com> wrote in message
> news:96659649-7A0D-488A-B6AD-C6BDD9A2651F@.microsoft.com...
> > And, when I refresh the report (in Preview tab, VS), sometimes all 5
> > chunks
> > are there, as desired...but then, I refresh again, and two are blank.
> > (just
> > the column headings, no data) then, refresh again, and a different two
> > are
> > blank.
> >
> > (by 'chunks', i just mean different sections of the report. this
> > particular
> > report has five different sections...or 'chunks'. each chunk has a
> > corresponding dataset)
> >
> > please advise. this is terribly urgent.
> > -- Lynn
> >
> >
> > "Lynn" wrote:
> >
> >> (sql/rs v2K, VS .Net 2003)
> >> I have a problem with several multi-dataset reports. I've got several
> >> single-dataset reports working just fine, but these multi-datasets are
> >> problematic. For example, I have one procedure which works w/out
> >> parameters,
> >> just returns a statistics report. I have modified the proc to accept a
> >> parameter. If @.ch =1 , give me the first chunk, if @.ch = 2, give me the
> >> 2nd
> >> chunk, etc., all the way thru to @.ch=5. All of them together comprise
> >> the
> >> whole report. The proc works just fine in query analyzer, like this:
> >>
> >> exec procname 1
> >> exec procname 2
> >> exec procname 3
> >> exec procname 4
> >> exec procname 5
> >>
> >> now, in RS, i have created 5 datasets. each with the fields returned by
> >> each procedure invocation. mind you, these aren't actual fields, it's
> >> select
> >> this as value, select this as count, select this as volume, etc.
> >>
> >> the datasets each are Text command types, the query strings are simply
> >> 'procname 1', 'procname 2', etc.
> >>
> >> all of them work just fine in the Data tab in VS.
> >> in the layout tab, i've created several tables and dragged/dropped the
> >> fields into each accordingly
> >>
> >> in the preview tab, i've got data returned in the top two chunks. WOW!
> >> cuz
> >> i have been trying this for a very long time, yesterday i had no data at
> >> all,
> >> only column headings, i don't know what i changed, but, now i have data
> >> in
> >> two chunks, none in the rest. only column headings.
> >>
> >> please, can anybody provide some direction on the right way to wrap the
> >> report(s) around procedures like this? remember, the procedures all all
> >> just
> >> statisitcal analysis data...no user input is required. i just need to
> >> deliver nicely via email on a scheduled basis.
> >>
> >> -- Lynn
>
>