Showing posts with label thati. Show all posts
Showing posts with label thati. Show all posts

Wednesday, March 28, 2012

How to schedule a profile to capture trace

Hello all,
Id like to schedule a profile to capture trace.
How can I set up a batch job for that?
I need a trace file instead of table, filter data by database id, size will
be 50MB, and start time will be 9:00 am and stop time will be 3:00pm.
Thanks in advance,
Do.
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...erver/200508/1
Hi,
Setup the server side trace. Vyas has got a really good article to autmate
serverside tracing.
See the below URL:-
http://vyaskn.tripod.com/server_side...sql_server.htm
Thanks
Hari
SQL Server MVP
"Do Park via droptable.com" <forum@.droptable.com> wrote in message
news:528E00B69080E@.droptable.com...
> Hello all,
> I'd like to schedule a profile to capture trace.
> How can I set up a batch job for that?
> I need a trace file instead of table, filter data by database id, size
> will
> be 50MB, and start time will be 9:00 am and stop time will be 3:00pm.
> Thanks in advance,
> Do.
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200508/1

How to schedule a profile to capture trace

Hello all,
Id like to schedule a profile to capture trace.
How can I set up a batch job for that?
I need a trace file instead of table, filter data by database id, size will
be 50MB, and start time will be 9:00 am and stop time will be 3:00pm.
Thanks in advance,
Do.
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200508/1Hi,
Setup the server side trace. Vyas has got a really good article to autmate
serverside tracing.
See the below URL:-
http://vyaskn.tripod.com/server_sid..._sql_server.htm
Thanks
Hari
SQL Server MVP
"Do Park via droptable.com" <forum@.droptable.com> wrote in message
news:528E00B69080E@.droptable.com...
> Hello all,
> I'd like to schedule a profile to capture trace.
> How can I set up a batch job for that?
> I need a trace file instead of table, filter data by database id, size
> will
> be 50MB, and start time will be 9:00 am and stop time will be 3:00pm.
> Thanks in advance,
> Do.
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200508/1

Monday, March 12, 2012

how to return a value in a stored procedure?

Hi,
i use a stored procedure for my asp.net application which must return a
value: (number of items). How can i do that?
I tried this but don't know how to giive te found value back.
Thansk
Chris
ALTER PROCEDURE [dbo].[mysp]
AS
declare @.returnValue int
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
select COUNT(DISTINCT numberofitems) from items
END
set @.returnValue = ?
return @.returnValueYou need to use an output parameter. Have a look at these:
http://msdn2.microsoft.com/en-us/library/ms971497.aspx
http://www.sommarskog.se/share_data.html
http://www.informit.com/articles/ar...8&seqNum=9&rl=1
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Chris" <ch@.spam.it> wrote in message
news:%23TUm6byIIHA.5860@.TK2MSFTNGP04.phx.gbl...
> Hi,
> i use a stored procedure for my asp.net application which must return a
> value: (number of items). How can i do that?
> I tried this but don't know how to giive te found value back.
> Thansk
> Chris
>
> ALTER PROCEDURE [dbo].[mysp]
> AS
> declare @.returnValue int
> BEGIN
> -- SET NOCOUNT ON added to prevent extra result sets from
> -- interfering with SELECT statements.
> SET NOCOUNT ON;
> -- Insert statements for procedure here
> select COUNT(DISTINCT numberofitems) from items
> END
> set @.returnValue = ?
> return @.returnValue
>|||Thanks
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> schreef in bericht
news:erDK$IzIIHA.4712@.TK2MSFTNGP04.phx.gbl...
> You need to use an output parameter. Have a look at these:
> http://msdn2.microsoft.com/en-us/library/ms971497.aspx
> http://www.sommarskog.se/share_data.html
> http://www.informit.com/articles/ar...8&seqNum=9&rl=1
>
> --
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
> "Chris" <ch@.spam.it> wrote in message
> news:%23TUm6byIIHA.5860@.TK2MSFTNGP04.phx.gbl...
>|||This is an example I just posted to my book's "Ask Answer" support site. It
calls a SP that returns the Identity value as a Return value. No, you don't
need an output parameter for this--the Return will work fine if you can pass
back an Int.
/****** Object: Stored Procedure dbo.Author_Insert Script Date: 12/7/98
5:08:41 PM ******/
ALTER Procedure Author_Insert @.Author varchar(50), @.Year_Born smallint
As
INSERT INTO Authors
( Author, Year_Born)
VALUES ( @.Author, @.Year_born )
RETURN SCOPE_IDENTITY()
'Copyright (c) 2007 Beta V Corporation. All rights reserved.
' For demonstration purposes only. No warranty of any kind expressed or
implied.
Imports System.Data.SqlClient
Public Class Form1
Dim cn As SqlConnection
Dim cmd As SqlCommand
Sub New()
InitializeComponent()
cn = New SqlConnection(My.Settings.BiblioConnection)
End Sub
Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnInsert.Click
Dim intRa, intIdentity As Integer
Try
cmd = New SqlCommand("Author_Insert", cn)
With cmd
.CommandType = CommandType.StoredProcedure
.Parameters.AddWithValue("@.Author", tbAuthor.Text)
.Parameters.AddWithValue("@.Year_Born", tbYearBorn.Text)
.Parameters.Add("@.ReturnValue", SqlDbType.Int) _
.Direction = ParameterDirection.ReturnValue ' To capture
RETURN value
cn.Open()
intRa = .ExecuteNonQuery
intIdentity = CInt(.Parameters("@.ReturnValue").Value)
End With
If intRa = 1 Then
MsgBox(String.Format("Row inserted. Identity value {0}", _
intIdentity), MsgBoxStyle.Exclamation)
Else
MsgBox("Insert failed")
End If
Catch exsql As SqlException
MessageBox.Show(exsql.ToString)
Catch ex As Exception
Debug.Assert(False, ex.ToString)
Finally
cn.Close()
End Try
End Sub
End Class
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
----
---
"Chris" <ch@.spam.it> wrote in message
news:%23TUm6byIIHA.5860@.TK2MSFTNGP04.phx.gbl...
> Hi,
> i use a stored procedure for my asp.net application which must return a
> value: (number of items). How can i do that?
> I tried this but don't know how to giive te found value back.
> Thansk
> Chris
>
> ALTER PROCEDURE [dbo].[mysp]
> AS
> declare @.returnValue int
> BEGIN
> -- SET NOCOUNT ON added to prevent extra result sets from
> -- interfering with SELECT statements.
> SET NOCOUNT ON;
> -- Insert statements for procedure here
> select COUNT(DISTINCT numberofitems) from items
> END
> set @.returnValue = ?
> return @.returnValue
>