Showing posts with label item. Show all posts
Showing posts with label item. Show all posts

Monday, March 19, 2012

How can I / Should I reuse SqlCacheDependency? thanks

I can create a SqlCacheDependency, and link it to a cached item in httpcontext cache. When something change, it will remove the cached item from the cache. I think I have to redo the process when that happens - prepare sql command, create SqlCacheDependency and insert the item into cache. Now I only need a notification from my SQL when something changes in one of my table, I don;t need read anything from db, and I think I should find a way to not recreate the SqlCacheDependency object everytime?

any suggestion?

Maybe you need a update/insert trigger that raise an error. For example, if you want to get notification when something changes in t1, you can use such T-SQL command to create a trigger:

create trigger trg_t1 on t1 for update,insert,delete
as
RAISERROR ('Some change has been made to table t1',16, 1)

go

To learn more about RAISERROR command, please take a look at:

http://msdn.microsoft.com/library/en-us/tsqlref/ts_ra-rz_5ooi.asp?frame=true

And for triggers you can start from here:

http://msdn.microsoft.com/library/en-us/createdb/cm_8_des_08_116g.asp?frame=true

|||I am not sure what the trigger you described can help in my case. What I need is a way to let DB notify ASP when something change, the change is made by other ASP httphandlers, so those change should go on without interrupt. Once the change is done, it should notify ASP, which will invalid the data that cached with SQLCacheDependency. The problem what I have is once that happens, the SQLCacheDepency object will be removed, I need recreate it again. I think it is unnecessory, since I only need a notification from DB.

How can change the visibillity of a Chart Data Field?

Hi,
is it possible to toggle the visibillity of a char data item? Because if the
value is zero or null i dont want the column in the chart to be displayed.
Thanks alot
FlorianIf a datapoint value is null, it won't be displayed in the chart.
If you want to explicitly hide datapoint with other values (e.g. y-value =0), you can use an expression for the datapoint value similar to this to
replace the value with null (Nothing in VB): =iif(Fields!Y.Value = 0,
Nothing, Fields!Y.Value)
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Florian Kirchlechner" <Florian Kirchlechner@.discussions.microsoft.com>
wrote in message news:31A10DB1-6A82-4AE8-AF21-A4658087ADB5@.microsoft.com...
> Hi,
> is it possible to toggle the visibillity of a char data item? Because if
> the
> value is zero or null i dont want the column in the chart to be displayed.
> Thanks alot
> Florian|||Hi Robert,
thx for the reply - it really helped me :-)
But one more thing - can i hide the series label too? I tried it with your
suggestions but it didnt work.
Thanks and greets /Flo
"Robert Bruckner [MSFT]" wrote:
> If a datapoint value is null, it won't be displayed in the chart.
> If you want to explicitly hide datapoint with other values (e.g. y-value => 0), you can use an expression for the datapoint value similar to this to
> replace the value with null (Nothing in VB): =iif(Fields!Y.Value = 0,
> Nothing, Fields!Y.Value)
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Florian Kirchlechner" <Florian Kirchlechner@.discussions.microsoft.com>
> wrote in message news:31A10DB1-6A82-4AE8-AF21-A4658087ADB5@.microsoft.com...
> > Hi,
> >
> > is it possible to toggle the visibillity of a char data item? Because if
> > the
> > value is zero or null i dont want the column in the chart to be displayed.
> >
> > Thanks alot
> > Florian
>
>|||No, you cannot dynamically hide series labels. Did you look into adding a
filter on the dataset or the chart or the series grouping to filter out all
data points with values you don't want to show in the chart?
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Florian Kirchlechner" <FlorianKirchlechner@.discussions.microsoft.com> wrote
in message news:BA66D7C0-D108-4BF0-9474-D5DD2FADF994@.microsoft.com...
> Hi Robert,
> thx for the reply - it really helped me :-)
> But one more thing - can i hide the series label too? I tried it with
> your
> suggestions but it didnt work.
> Thanks and greets /Flo
> "Robert Bruckner [MSFT]" wrote:
>> If a datapoint value is null, it won't be displayed in the chart.
>> If you want to explicitly hide datapoint with other values (e.g. y-value
>> =>> 0), you can use an expression for the datapoint value similar to this to
>> replace the value with null (Nothing in VB): =iif(Fields!Y.Value = 0,
>> Nothing, Fields!Y.Value)
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Florian Kirchlechner" <Florian Kirchlechner@.discussions.microsoft.com>
>> wrote in message
>> news:31A10DB1-6A82-4AE8-AF21-A4658087ADB5@.microsoft.com...
>> > Hi,
>> >
>> > is it possible to toggle the visibillity of a char data item? Because
>> > if
>> > the
>> > value is zero or null i dont want the column in the chart to be
>> > displayed.
>> >
>> > Thanks alot
>> > Florian
>>|||Im looking for a method to filter the data points without a value and also to
not have their series labels displayed in the legend. Maybe i will overcome
that with manually generating the legend.
Thanks alot
Florian
"Robert Bruckner [MSFT]" wrote:
> No, you cannot dynamically hide series labels. Did you look into adding a
> filter on the dataset or the chart or the series grouping to filter out all
> data points with values you don't want to show in the chart?
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Florian Kirchlechner" <FlorianKirchlechner@.discussions.microsoft.com> wrote
> in message news:BA66D7C0-D108-4BF0-9474-D5DD2FADF994@.microsoft.com...
> > Hi Robert,
> > thx for the reply - it really helped me :-)
> > But one more thing - can i hide the series label too? I tried it with
> > your
> > suggestions but it didnt work.
> >
> > Thanks and greets /Flo
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> >> If a datapoint value is null, it won't be displayed in the chart.
> >> If you want to explicitly hide datapoint with other values (e.g. y-value
> >> => >> 0), you can use an expression for the datapoint value similar to this to
> >> replace the value with null (Nothing in VB): =iif(Fields!Y.Value = 0,
> >> Nothing, Fields!Y.Value)
> >>
> >> -- Robert
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Florian Kirchlechner" <Florian Kirchlechner@.discussions.microsoft.com>
> >> wrote in message
> >> news:31A10DB1-6A82-4AE8-AF21-A4658087ADB5@.microsoft.com...
> >> > Hi,
> >> >
> >> > is it possible to toggle the visibillity of a char data item? Because
> >> > if
> >> > the
> >> > value is zero or null i dont want the column in the chart to be
> >> > displayed.
> >> >
> >> > Thanks alot
> >> > Florian
> >>
> >>
> >>
>
>|||It may be easier to filter the chart series groups, but generating a custom
legend is also possible. This blog article including a sample should get you
started: http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Florian Kirchlechner" <FlorianKirchlechner@.discussions.microsoft.com> wrote
in message news:2EC010BC-D1BA-4F57-9F92-CE0CAF37F6A9@.microsoft.com...
> Im looking for a method to filter the data points without a value and also
> to
> not have their series labels displayed in the legend. Maybe i will
> overcome
> that with manually generating the legend.
> Thanks alot
> Florian
>
> "Robert Bruckner [MSFT]" wrote:
>> No, you cannot dynamically hide series labels. Did you look into adding a
>> filter on the dataset or the chart or the series grouping to filter out
>> all
>> data points with values you don't want to show in the chart?
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> "Florian Kirchlechner" <FlorianKirchlechner@.discussions.microsoft.com>
>> wrote
>> in message news:BA66D7C0-D108-4BF0-9474-D5DD2FADF994@.microsoft.com...
>> > Hi Robert,
>> > thx for the reply - it really helped me :-)
>> > But one more thing - can i hide the series label too? I tried it with
>> > your
>> > suggestions but it didnt work.
>> >
>> > Thanks and greets /Flo
>> >
>> > "Robert Bruckner [MSFT]" wrote:
>> >
>> >> If a datapoint value is null, it won't be displayed in the chart.
>> >> If you want to explicitly hide datapoint with other values (e.g.
>> >> y-value
>> >> =>> >> 0), you can use an expression for the datapoint value similar to this
>> >> to
>> >> replace the value with null (Nothing in VB): =iif(Fields!Y.Value = 0,
>> >> Nothing, Fields!Y.Value)
>> >>
>> >> -- Robert
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>> >> "Florian Kirchlechner" <Florian
>> >> Kirchlechner@.discussions.microsoft.com>
>> >> wrote in message
>> >> news:31A10DB1-6A82-4AE8-AF21-A4658087ADB5@.microsoft.com...
>> >> > Hi,
>> >> >
>> >> > is it possible to toggle the visibillity of a char data item?
>> >> > Because
>> >> > if
>> >> > the
>> >> > value is zero or null i dont want the column in the chart to be
>> >> > displayed.
>> >> >
>> >> > Thanks alot
>> >> > Florian
>> >>
>> >>
>> >>
>>|||Since you said there is not a way to dynamically hide a label, is there a way
to always hide a series label? I have one line that should not have a label,
but if I set the label to "=Nothing", "=System.DBNULL.Value", or just leave
it blank it puts something automatic like "Series3" -- how can I remove this?
-diana
"Robert Bruckner [MSFT]" wrote:
> No, you cannot dynamically hide series labels. Did you look into adding a
> filter on the dataset or the chart or the series grouping to filter out all
> data points with values you don't want to show in the chart?
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Florian Kirchlechner" <FlorianKirchlechner@.discussions.microsoft.com> wrote
> in message news:BA66D7C0-D108-4BF0-9474-D5DD2FADF994@.microsoft.com...
> > Hi Robert,
> > thx for the reply - it really helped me :-)
> > But one more thing - can i hide the series label too? I tried it with
> > your
> > suggestions but it didnt work.
> >
> > Thanks and greets /Flo
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> >> If a datapoint value is null, it won't be displayed in the chart.
> >> If you want to explicitly hide datapoint with other values (e.g. y-value
> >> => >> 0), you can use an expression for the datapoint value similar to this to
> >> replace the value with null (Nothing in VB): =iif(Fields!Y.Value = 0,
> >> Nothing, Fields!Y.Value)
> >>
> >> -- Robert
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Florian Kirchlechner" <Florian Kirchlechner@.discussions.microsoft.com>
> >> wrote in message
> >> news:31A10DB1-6A82-4AE8-AF21-A4658087ADB5@.microsoft.com...
> >> > Hi,
> >> >
> >> > is it possible to toggle the visibillity of a char data item? Because
> >> > if
> >> > the
> >> > value is zero or null i dont want the column in the chart to be
> >> > displayed.
> >> >
> >> > Thanks alot
> >> > Florian
> >>
> >>
> >>
>
>

Friday, March 9, 2012

how are these queries evaluted differently by sql server?

I'm looking for the minimum date of an entry into a history table. The table contains multiple entries for the customer and the item with an activation and deactivation date for each entry.

I could use the following:

select customerId, item, min(activationDate) from history group by customerId, item

or a sub query

select customerId, item, activationDate

from history h1

where activationDate=(select min(activationDate) from history h2 where h2.customerId=h1.customerId and h2.item=h1.item)

How are these two queries parsed differently by SQL.

They return a different number of results.

Thanks,

karen

I'm guessing that customerId and item do not uniquely define a record in the table, is this true? If so, that would explain the difference in the amount of rows between the two result sets.

-The first query finds the minimum activationDate for each unique customerId and item.

-The second query finds the minimum activationDate for each customerId and item.

-If you add a group by customerId, item to the second query you should have matching result sets.

The inner query of the correlated subquery is processed once per record of the outer query.

|||

If you have the following data in the table:

CustomerID - Item - ActivationDate

1 1 1/1/2007

1 1 1/1/2007

The first query will return one record while the second query will return two. This is because (as the above post indicates), that the first query is returning a true grouping while the second will return duplicate records if there is duplicate data in the table.

|||

Bcs there are duplicate entries available on your database..

You can force DISTINCT class to fix this..

Sample..

Create Table #samplehistory (

[customerId] int ,

[item] int ,

[activationDate] datetime

);

Insert Into #samplehistory Values('1','1','1/1/2007');

Insert Into #samplehistory Values('1','1','1/2/2006');

Insert Into #samplehistory Values('1','1','1/3/2006');

Insert Into #samplehistory Values('1','2','1/11/2007');

Insert Into #samplehistory Values('1','2','1/11/2003');

Insert Into #samplehistory Values('1','2','1/11/2002');

select

customerId,

item,

min(activationDate) activationDate

from

#samplehistory

group by

customerId, item

select

customerId,

item,

activationDate

from

#samplehistory h1

where

activationDate=

(

select

min(activationDate)

from #samplehistory h2

where

h2.customerId=h1.customerId

and h2.item=h1.item)

/*

customerIditemactivationDate

-- -- --

112006-01-02 00:00:00.000

122002-01-11 00:00:00.000

*/

After duplicating one of the value.. You are result is correct but there are dupicate data in the result

Insert Into #samplehistory Values('1','2','1/11/2002');

select

customerId,

item,

min(activationDate)

from

#samplehistory

group by

customerId, item

/*

customerIditemactivationDate

-- -- --

112006-01-02 00:00:00.000

122002-01-11 00:00:00.000

*/

select

customerId,

item,

activationDate

from

#samplehistory h1

where

activationDate=

(

select

min(activationDate)

from #samplehistory h2

where

h2.customerId=h1.customerId

and h2.item=h1.item)

/*

customerIditemactivationDate

-- -- --

112006-01-02 00:00:00.000

122002-01-11 00:00:00.000

122002-01-11 00:00:00.000

*/

The group by class force the First query to avoid the duplicates (already distincted values are return).

After Distinct on second query,

Code Snippet

select distinct

customerId,

item,

activationDate

from

#samplehistory h1

where

activationDate=

(

select

min(activationDate)

from #samplehistory h2

where

h2.customerId=h1.customerId

and h2.item=h1.item)

/*

customerIditemactivationDate

-- -- --

112006-01-02 00:00:00.000

122002-01-11 00:00:00.000

*/

|||

Thank you very much for your help. I really appreciate the time.

Would you recommend a book for dealing with these kinds of sublties in SQL?

Karen

|||

Inside SQL Server 2005 T-SQL Querying by Itzik Ben-Gan is very good.

|||Ken Henderson's "The Guru's Guide to Transact-SQL" is also very good.

Friday, February 24, 2012

hot key for "Expression" in VS2005

Is there a hotkey for "Expression" right-click menu item in report designer?
--
Regards,
Dmitryit sure would be nice if they gave us office-style shortcut keys;
instead of subjecting us to a piece of shit IDE for uber-geeks
VS crashes on me; it's slow..
time to correct your strategy, Microsoft.. moving Query Analyzer and
Enterprise Manager did _NOTHING_ to help database developers.
Making BIDS in VS instead of in Office?
IT DID NOTHING TO HELP US OUT.
-Susie
Dmitry Duginov wrote:
> Is there a hotkey for "Expression" right-click menu item in report designer?
> --
> Regards,
> Dmitry|||Hi Dmitry,
There is no HotKey for "Expression".
You could click the Context Menu Key and then click "E".
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Wei;
THERE SHOULD BE A SHORTCUT KEY FOR EVERYTHING
stop forcing people to use Visual Studio for everything; it's not as
user-friendly as Office is.
-Aaron
Wei Lu [MSFT] wrote:
> Hi Dmitry,
> There is no HotKey for "Expression".
> You could click the Context Menu Key and then click "E".
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
> ==================================================> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)|||Hello Aaron,
You could set up your customize Hotkey in the Visual Studio. But it does
not contain the Expression action, so we could not set a Hotkey for this
operation.
To provide your feedback directly to the product groups:
http://connect.microsoft.com/VisualStudio
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||it's another symptom that MS should have used Office instead of VS for
BIDS.
VS is a usability NIGHTMARE.
maybe you kids should stop selling us on new products; and start using
your existing products
-Susie
Wei Lu [MSFT] wrote:
> Hello Aaron,
> You could set up your customize Hotkey in the Visual Studio. But it does
> not contain the Expression action, so we could not set a Hotkey for this
> operation.
> To provide your feedback directly to the product groups:
> http://connect.microsoft.com/VisualStudio
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no rights.|||Hello Susie,
If you have any concern, please send your feedback to the Product Team
directly.
http://connect.microsoft.com/VisualStudio
Microsoft will consider your request and improve our product. Thank you!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||how about SQL authtentication?
where can we send feedback about having a gaping hole in ALL of our
databases for the past decade?
Do you really think that Microsoft LISTENS to anyone outside the
company?
Can SQL Authentication be secured?
How does Oracle and IBM and mySql do it?
Why is it that Microsoft has ZERO ABILITY to secure SQL
authentication'
Wei Lu [MSFT] wrote:
> Hello Susie,
> If you have any concern, please send your feedback to the Product Team
> directly.
> http://connect.microsoft.com/VisualStudio
> Microsoft will consider your request and improve our product. Thank you!
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no rights.