Showing posts with label filter. Show all posts
Showing posts with label filter. 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,
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 SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-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_side_tracing_in_sql_server.htm
Thanks
Hari
SQL Server MVP
"Do Park via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:528E00B69080E@.SQLMonster.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 SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/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 all records when date filter parameter is missing

I'm using an objectDataSource connected to a strongly typed dataset to populate a GridView. I want to be able to show all the records, or let the user to select only those records that expire in a certain month. The expire field is of type date

I'm used to all records being returned when a parameter is missing. If I have Select * from table where last=@.last, only the records where the last name is 'Smith' will be returned if @.last = 'Smith', but all records are returned is @.last = "". But that's not how it's working with the date.

I'm passing an integer from 1 to 12 in a querystring. I have the equivalent of

select * from table where (MONTH([AD ENDS]) = @.month)

MONTH(datefield) always returns an integer from 1 to 12. If @.month is empty, I want all the records to be displayed, but nothing is. If @.month is an int form 1 to 12, it works fine. How can I get all the records if no month is selected? Can I have two objectdatasources and programmatically select which one populates the gridview depending on if I want to filter the data or not?

Diane

HI Diane,

It think there are two options that might be better than having two objectdatasources.

1:change the select statement programmatically
strSQL = "select * from table ";
if (strMyMonth == string.empty)
{ strSQL+= "where (MONTH([AD ENDS]) = @.month)"}
else
{srSQL += "where (MONTH([AD ENDS]) > Date('01/01/0001')}

2:use the databases own If Then Else capabilities (this is dependent on your DB.. I know oracle, sqlserver and even access allows this)

Access Example: If [targetgoal] <> 0 then ([Total Of $FeeBilled]/6)*12)/[TargetGoal] else [targetgoal]= 0

|||I don't know how you can get all records without send anything in with Select * from table wherelast=@.last

But I would try to use Select * from table where last=ISNULL(@.last,last).

For the month query,please try something like this:

WHEREMONTH(tDate)=ISNULL(@.month,MONTH(tDate))

|||

Yup, those are much better options. I forgot about changing the select statement programmatically. Been at this too many hours I guess. I like the idea of using the database's capabilities though. If my current select statement is select * from table where (MONTH([AD ENDS]) = @.month) and I'm using SQL Server 2005, what would the new select statement be?

select * from table where ( If @.month <> 0 then (MONTH([AD ENDS]) = @.month) )?

or

select * from table ( If @.month <> 0 then (whereMONTH([AD ENDS]) = @.month) )?

Diane

|||SELECT * FROM Table WHERE MONTH([AD ENDS]) = ISNULL(@.month, MONTH([AD ENDS])|||

Thank you Dinakar! That worked!

Linmo, in a strongly typed dataset (which are pretty much all I know in .NET so far), if an empty parameter is returned, the filter for that parameter isn't set. This behavior is a life saver IMHO. It kust had me stumped this time around.

Diane

Friday, February 24, 2012

How to retrieve data between two dates

For e.g
I want the amount of a customer between 2nd March 2004 and 2nd October
2004.
Basically How to filter this as i cannot put it in a where clause.i.e
customer name in rows amount in columns.
Is this in SQL Server or AS?
If the former, please post DDL, sample data, and sample output.
http://www.aspfaq.com/etiquette.asp?id=5006
If the latter, I will let someone else handle this question
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"Amit Asawa" <amit.asawa@.capgemini.com> wrote in message
news:814276fc.0412022212.7d57e2da@.posting.google.c om...
> For e.g
>
> I want the amount of a customer between 2nd March 2004 and 2nd October
> 2004.
> Basically How to filter this as i cannot put it in a where clause.i.e
> customer name in rows amount in columns.
|||If u have got solution to this problem can u please forward it to me at mailketna@.yahoo.com.
I have same problem in asp.net in crystal reports.
Thankyou
************************************************** ********************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
|||Can you post DDL, sample data, and sample output? I'll help you out, but
not via e-mail. Let's keep this public so that others can benefit from the
discussion as well.
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"jalpa patel" <mailketna@.yahoo.com> wrote in message
news:u%23l$ihn4EHA.3388@.TK2MSFTNGP15.phx.gbl...
> If u have got solution to this problem can u please forward it to me at
mailketna@.yahoo.com.
> I have same problem in asp.net in crystal reports.
> Thankyou
> ************************************************** ********************
> Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...

How to retrieve data between two dates

For e.g
I want the amount of a customer between 2nd March 2004 and 2nd October
2004.
Basically How to filter this as i cannot put it in a where clause.i.e
customer name in rows amount in columns.Is this in SQL Server or AS?
If the former, please post DDL, sample data, and sample output.
http://www.aspfaq.com/etiquette.asp?id=5006
If the latter, I will let someone else handle this question
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Amit Asawa" <amit.asawa@.capgemini.com> wrote in message
news:814276fc.0412022212.7d57e2da@.posting.google.com...
> For e.g
>
> I want the amount of a customer between 2nd March 2004 and 2nd October
> 2004.
> Basically How to filter this as i cannot put it in a where clause.i.e
> customer name in rows amount in columns.|||If u have got solution to this problem can u please forward it to me at mail
ketna@.yahoo.com.
I have same problem in asp.net in crystal reports.
Thankyou
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...|||Can you post DDL, sample data, and sample output? I'll help you out, but
not via e-mail. Let's keep this public so that others can benefit from the
discussion as well.
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"jalpa patel" <mailketna@.yahoo.com> wrote in message
news:u%23l$ihn4EHA.3388@.TK2MSFTNGP15.phx.gbl...
> If u have got solution to this problem can u please forward it to me at
mailketna@.yahoo.com.
> I have same problem in asp.net in crystal reports.
> Thankyou
> ****************************************
******************************
> Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...