Showing posts with label creating. Show all posts
Showing posts with label creating. Show all posts

Tuesday, March 27, 2012

emailsubscription - eventpolling, but no notificationpolling

Hi,
>From script i'm sending a few emails with pdf attachments.
One report is mailed, two others not. The script for creating the
subscriptions is equal, only different parameters.
When I look in the logfiles I don't see any errors, however only the
succeeded report has both event- and notificationpolling logging.
So the logging for the succeeded one is:
ReportingServicesService!dbpolling!1240!04/30/2005-05:49:52::
EventPolling processing item f21fb887-9e00-40c5-8fac-f246ad14bd4f
ReportingServicesService!dbpolling!194!30.04.2005-05:49:52::
EventPolling processing 1 more items. 1 Total items in internal queue.
ReportingServicesService!library!1240!04/30/2005-05:49:53:: Schedule
3461442c-d51f-4701-9413-a5bef0d283a0 executed at 04/30/2005 05:49:53.
ReportingServicesService!schedule!1240!04/30/2005-05:49:53:: Creating
Time based subscription notification for subscription:
3424547a-9e5a-4e74-8bd1-78af62a38490
ReportingServicesService!library!1240!04/30/2005-05:49:53:: Schedule
3461442c-d51f-4701-9413-a5bef0d283a0 execution completed at 04/30/2005
05:49:53.
ReportingServicesService!dbpolling!1240!04/30/2005-05:49:53::
EventPolling finished processing item
f21fb887-9e00-40c5-8fac-f246ad14bd4f
ReportingServicesService!dbpolling!194!30.04.2005-05:49:53::
EventPolling processing 1 more items. 1 Total items in internal queue.
ReportingServicesService!dbpolling!1240!04/30/2005-05:49:53::
EventPolling processing item 351c51cd-2274-4218-b92e-f05ebdcc0bcb
ReportingServicesService!dbpolling!1240!04/30/2005-05:49:53::
EventPolling finished processing item
351c51cd-2274-4218-b92e-f05ebdcc0bcb
ReportingServicesService!dbpolling!194!30.04.2005-05:49:54::
NotificationPolling processing 1 more items. 1 Total items in internal
queue.
ReportingServicesService!dbpolling!1240!04/30/2005-05:49:54::
NotificationPolling processing item
72b719c2-1ae2-4e7a-a096-b15364e8ebd4
ReportingServicesService!library!1240!04/30/2005-05:49:55:: i INFO:
Call to RenderFirst( '/KEAS/KEASReports/Analyse' )
ReportingServicesService!library!1240!04/30/2005-05:49:56:: i INFO:
Initializing EnableExecutionLogging to 'True' as specified in Server
system properties.
ReportingServicesService!emailextension!1240!04/30/2005-05:49:57::
Email successfully sent to "spitz@.tiscali.nl" <spitz@.tiscali.nl>
ReportingServicesService!library!1240!04/30/2005-05:49:57:: Data Driven
Notification for activation id eff41ff5-c76d-4ced-be63-377e82daf4bb was
saved.
ReportingServicesService!library!1240!04/30/2005-05:49:57:: Status:
Mail sent to spitz@.tiscali.nl;
ReportingServicesService!notification!1240!04/30/2005-05:49:57::
Notification 72b719c2-1ae2-4e7a-a096-b15364e8ebd4 completed. Success:
True, Status: Mail sent to spitz@.tiscali.nl;, DeliveryExtension: Report
Server Email, Report: Analyse, Attempt 0
ReportingServicesService!dbpolling!1240!04/30/2005-05:49:57::
NotificationPolling finished processing item
72b719c2-1ae2-4e7a-a096-b15364e8ebd4
The logging for the ones that are not mailed (the subscriptions are
created):
ReportingServicesService!dbpolling!194!30.04.2005-05:48:52::
EventPolling processing 1 more items. 1 Total items in internal queue.
ReportingServicesService!dbpolling!1240!04/30/2005-05:48:52::
EventPolling processing item a3d3a5e0-4634-4f32-ab10-8564fa09be40
ReportingServicesService!library!1240!04/30/2005-05:48:52:: Schedule
54043fb7-5eec-4063-ae6e-a0ed054e538c executed at 04/30/2005 05:48:52.
ReportingServicesService!schedule!1240!04/30/2005-05:48:52:: Creating
Time based subscription notification for subscription:
9e5701ab-2fc5-48ab-8290-ae05f55fb29f
ReportingServicesService!library!1240!04/30/2005-05:48:53:: Schedule
54043fb7-5eec-4063-ae6e-a0ed054e538c execution completed at 04/30/2005
05:48:53.
ReportingServicesService!dbpolling!194!30.04.2005-05:48:53::
EventPolling processing 1 more items. 1 Total items in internal queue.
ReportingServicesService!dbpolling!1240!04/30/2005-05:48:53::
EventPolling finished processing item
a3d3a5e0-4634-4f32-ab10-8564fa09be40
ReportingServicesService!dbpolling!1240!04/30/2005-05:48:53::
EventPolling processing item 7efce5e2-8cca-4e87-9ac9-f2bac7ad68ff
ReportingServicesService!dbpolling!1240!04/30/2005-05:48:53::
EventPolling finished processing item
7efce5e2-8cca-4e87-9ac9-f2bac7ad68ff
The securitysettings for all reports are equal.
The failed jobs are also not mailed if started from sqlagent (although
they succeed as sqlagentjob)
Any suggestions are more than welcome, since i have no clue how to
solve this!
Regards jespHave you tried viewing the subscriptions through Report Manager? Perhaps
something is not set up correctly causing the subscription to not fire
correctly.
Have you tried creating the same subscriptions through Report Manager?
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"jesp" <spitz@.tiscali.nl> wrote in message
news:1115007058.978980.232660@.o13g2000cwo.googlegroups.com...
> Hi,
>>From script i'm sending a few emails with pdf attachments.
> One report is mailed, two others not. The script for creating the
> subscriptions is equal, only different parameters.
> When I look in the logfiles I don't see any errors, however only the
> succeeded report has both event- and notificationpolling logging.
> So the logging for the succeeded one is:
> ReportingServicesService!dbpolling!1240!04/30/2005-05:49:52::
> EventPolling processing item f21fb887-9e00-40c5-8fac-f246ad14bd4f
> ReportingServicesService!dbpolling!194!30.04.2005-05:49:52::
> EventPolling processing 1 more items. 1 Total items in internal queue.
> ReportingServicesService!library!1240!04/30/2005-05:49:53:: Schedule
> 3461442c-d51f-4701-9413-a5bef0d283a0 executed at 04/30/2005 05:49:53.
> ReportingServicesService!schedule!1240!04/30/2005-05:49:53:: Creating
> Time based subscription notification for subscription:
> 3424547a-9e5a-4e74-8bd1-78af62a38490
> ReportingServicesService!library!1240!04/30/2005-05:49:53:: Schedule
> 3461442c-d51f-4701-9413-a5bef0d283a0 execution completed at 04/30/2005
> 05:49:53.
> ReportingServicesService!dbpolling!1240!04/30/2005-05:49:53::
> EventPolling finished processing item
> f21fb887-9e00-40c5-8fac-f246ad14bd4f
> ReportingServicesService!dbpolling!194!30.04.2005-05:49:53::
> EventPolling processing 1 more items. 1 Total items in internal queue.
> ReportingServicesService!dbpolling!1240!04/30/2005-05:49:53::
> EventPolling processing item 351c51cd-2274-4218-b92e-f05ebdcc0bcb
> ReportingServicesService!dbpolling!1240!04/30/2005-05:49:53::
> EventPolling finished processing item
> 351c51cd-2274-4218-b92e-f05ebdcc0bcb
> ReportingServicesService!dbpolling!194!30.04.2005-05:49:54::
> NotificationPolling processing 1 more items. 1 Total items in internal
> queue.
> ReportingServicesService!dbpolling!1240!04/30/2005-05:49:54::
> NotificationPolling processing item
> 72b719c2-1ae2-4e7a-a096-b15364e8ebd4
> ReportingServicesService!library!1240!04/30/2005-05:49:55:: i INFO:
> Call to RenderFirst( '/KEAS/KEASReports/Analyse' )
> ReportingServicesService!library!1240!04/30/2005-05:49:56:: i INFO:
> Initializing EnableExecutionLogging to 'True' as specified in Server
> system properties.
> ReportingServicesService!emailextension!1240!04/30/2005-05:49:57::
> Email successfully sent to "spitz@.tiscali.nl" <spitz@.tiscali.nl>
> ReportingServicesService!library!1240!04/30/2005-05:49:57:: Data Driven
> Notification for activation id eff41ff5-c76d-4ced-be63-377e82daf4bb was
> saved.
> ReportingServicesService!library!1240!04/30/2005-05:49:57:: Status:
> Mail sent to spitz@.tiscali.nl;
> ReportingServicesService!notification!1240!04/30/2005-05:49:57::
> Notification 72b719c2-1ae2-4e7a-a096-b15364e8ebd4 completed. Success:
> True, Status: Mail sent to spitz@.tiscali.nl;, DeliveryExtension: Report
> Server Email, Report: Analyse, Attempt 0
> ReportingServicesService!dbpolling!1240!04/30/2005-05:49:57::
> NotificationPolling finished processing item
> 72b719c2-1ae2-4e7a-a096-b15364e8ebd4
> The logging for the ones that are not mailed (the subscriptions are
> created):
> ReportingServicesService!dbpolling!194!30.04.2005-05:48:52::
> EventPolling processing 1 more items. 1 Total items in internal queue.
> ReportingServicesService!dbpolling!1240!04/30/2005-05:48:52::
> EventPolling processing item a3d3a5e0-4634-4f32-ab10-8564fa09be40
> ReportingServicesService!library!1240!04/30/2005-05:48:52:: Schedule
> 54043fb7-5eec-4063-ae6e-a0ed054e538c executed at 04/30/2005 05:48:52.
> ReportingServicesService!schedule!1240!04/30/2005-05:48:52:: Creating
> Time based subscription notification for subscription:
> 9e5701ab-2fc5-48ab-8290-ae05f55fb29f
> ReportingServicesService!library!1240!04/30/2005-05:48:53:: Schedule
> 54043fb7-5eec-4063-ae6e-a0ed054e538c execution completed at 04/30/2005
> 05:48:53.
> ReportingServicesService!dbpolling!194!30.04.2005-05:48:53::
> EventPolling processing 1 more items. 1 Total items in internal queue.
> ReportingServicesService!dbpolling!1240!04/30/2005-05:48:53::
> EventPolling finished processing item
> a3d3a5e0-4634-4f32-ab10-8564fa09be40
> ReportingServicesService!dbpolling!1240!04/30/2005-05:48:53::
> EventPolling processing item 7efce5e2-8cca-4e87-9ac9-f2bac7ad68ff
> ReportingServicesService!dbpolling!1240!04/30/2005-05:48:53::
> EventPolling finished processing item
> 7efce5e2-8cca-4e87-9ac9-f2bac7ad68ff
>
> The securitysettings for all reports are equal.
> The failed jobs are also not mailed if started from sqlagent (although
> they succeed as sqlagentjob)
> Any suggestions are more than welcome, since i have no clue how to
> solve this!
> Regards jesp
>sql

Monday, March 26, 2012

Emailing Reports

Hi everyone I have a database that I am creating for another department. He emails applications to potential vendors. And I was wanting sql to do this for him. I was reading about xtended procedures XP_Sendmail, but this is the first time I have created an extended stored procedure. I need for it to email an attachment (the report)Read BOL on xp_sendmail. It's all there.sql

Wednesday, March 21, 2012

Email Subscription

Hi There,
Is it posible to create a subscribers list during run time of the report?
How can I specify that while creating a sbuscription in Report Manager?.
For Example,
I've a report which takes 3 parameters. Date1,Date2,EmpID.
The report has to send to only one user thru depending on the EmpID parameter. How can I specify the query while creating the subscription?.
If this can not be done thru subscription. Can this can be done on DeliveryExtension. Any code samples?.
Any help would be much appreciated!.
Thanks in advance.Data Driven Subscriptions can accomplish this. Look at the following
article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSUIREF/htm/f1_rsc_manager_v1_9syq.asp
You can not dynamically change the delivery extension though.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kavi" <Kavi@.discussions.microsoft.com> wrote in message
news:26B225A6-AA5D-4630-ABA8-D119D3E03087@.microsoft.com...
> Hi There,
> Is it posible to create a subscribers list during run time of the report?
> How can I specify that while creating a sbuscription in Report Manager?.
> For Example,
> I've a report which takes 3 parameters. Date1,Date2,EmpID.
> The report has to send to only one user thru depending on the EmpID
parameter. How can I specify the query while creating the subscription?.
> If this can not be done thru subscription. Can this can be done on
DeliveryExtension. Any code samples?.
> Any help would be much appreciated!.
> Thanks in advance.
>|||Hi Daniel,
I've tried this before I put this query on Newsgroup.
I find the difficulty in specifying the query in the subscription:
select email from tbl_subscribers where uid=@.EmpID(Which is Report Parameter).
can I do this, if so how can I specify the query. The above query is not validating & gives an error message "@.EmpID must be declared".
Thnaks.
"Daniel Reib [MSFT]" wrote:
> Data Driven Subscriptions can accomplish this. Look at the following
> article:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSUIREF/htm/f1_rsc_manager_v1_9syq.asp
> You can not dynamically change the delivery extension though.
> --
> -Daniel
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Kavi" <Kavi@.discussions.microsoft.com> wrote in message
> news:26B225A6-AA5D-4630-ABA8-D119D3E03087@.microsoft.com...
> > Hi There,
> >
> > Is it posible to create a subscribers list during run time of the report?
> >
> > How can I specify that while creating a sbuscription in Report Manager?.
> >
> > For Example,
> >
> > I've a report which takes 3 parameters. Date1,Date2,EmpID.
> >
> > The report has to send to only one user thru depending on the EmpID
> parameter. How can I specify the query while creating the subscription?.
> >
> > If this can not be done thru subscription. Can this can be done on
> DeliveryExtension. Any code samples?.
> >
> > Any help would be much appreciated!.
> >
> > Thanks in advance.
> >
>
>|||Sorry. I hope I can not use Data Driven Subscription, since I don't have "Enterprise Edition of SQL Server 2000". I've only Standard Edition.
Is there any other way I can accomplish the task & any samples?.
Thanks.
"Daniel Reib [MSFT]" wrote:
> Data Driven Subscriptions can accomplish this. Look at the following
> article:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSUIREF/htm/f1_rsc_manager_v1_9syq.asp
> You can not dynamically change the delivery extension though.
> --
> -Daniel
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Kavi" <Kavi@.discussions.microsoft.com> wrote in message
> news:26B225A6-AA5D-4630-ABA8-D119D3E03087@.microsoft.com...
> > Hi There,
> >
> > Is it posible to create a subscribers list during run time of the report?
> >
> > How can I specify that while creating a sbuscription in Report Manager?.
> >
> > For Example,
> >
> > I've a report which takes 3 parameters. Date1,Date2,EmpID.
> >
> > The report has to send to only one user thru depending on the EmpID
> parameter. How can I specify the query while creating the subscription?.
> >
> > If this can not be done thru subscription. Can this can be done on
> DeliveryExtension. Any code samples?.
> >
> > Any help would be much appreciated!.
> >
> > Thanks in advance.
> >
>
>|||Unfortunately there is no real way to accomplish this in the Standard
Edition. You would have to create a subscription for each user.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kavi" <Kavi@.discussions.microsoft.com> wrote in message
news:1824340C-E14E-470F-835C-FE8DC3904ABF@.microsoft.com...
> Sorry. I hope I can not use Data Driven Subscription, since I don't have
"Enterprise Edition of SQL Server 2000". I've only Standard Edition.
> Is there any other way I can accomplish the task & any samples?.
> Thanks.
> "Daniel Reib [MSFT]" wrote:
> > Data Driven Subscriptions can accomplish this. Look at the following
> > article:
> >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSUIREF/htm/f1_rsc_manager_v1_9syq.asp
> >
> > You can not dynamically change the delivery extension though.
> >
> > --
> > -Daniel
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "Kavi" <Kavi@.discussions.microsoft.com> wrote in message
> > news:26B225A6-AA5D-4630-ABA8-D119D3E03087@.microsoft.com...
> > > Hi There,
> > >
> > > Is it posible to create a subscribers list during run time of the
report?
> > >
> > > How can I specify that while creating a sbuscription in Report
Manager?.
> > >
> > > For Example,
> > >
> > > I've a report which takes 3 parameters. Date1,Date2,EmpID.
> > >
> > > The report has to send to only one user thru depending on the EmpID
> > parameter. How can I specify the query while creating the subscription?.
> > >
> > > If this can not be done thru subscription. Can this can be done on
> > DeliveryExtension. Any code samples?.
> > >
> > > Any help would be much appreciated!.
> > >
> > > Thanks in advance.
> > >
> >
> >
> >|||Ohh...Thnaks Daniel.
"Daniel Reib [MSFT]" wrote:
> Unfortunately there is no real way to accomplish this in the Standard
> Edition. You would have to create a subscription for each user.
> --
> -Daniel
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Kavi" <Kavi@.discussions.microsoft.com> wrote in message
> news:1824340C-E14E-470F-835C-FE8DC3904ABF@.microsoft.com...
> > Sorry. I hope I can not use Data Driven Subscription, since I don't have
> "Enterprise Edition of SQL Server 2000". I've only Standard Edition.
> >
> > Is there any other way I can accomplish the task & any samples?.
> >
> > Thanks.
> >
> > "Daniel Reib [MSFT]" wrote:
> >
> > > Data Driven Subscriptions can accomplish this. Look at the following
> > > article:
> > >
> > >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSUIREF/htm/f1_rsc_manager_v1_9syq.asp
> > >
> > > You can not dynamically change the delivery extension though.
> > >
> > > --
> > > -Daniel
> > > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > >
> > >
> > > "Kavi" <Kavi@.discussions.microsoft.com> wrote in message
> > > news:26B225A6-AA5D-4630-ABA8-D119D3E03087@.microsoft.com...
> > > > Hi There,
> > > >
> > > > Is it posible to create a subscribers list during run time of the
> report?
> > > >
> > > > How can I specify that while creating a sbuscription in Report
> Manager?.
> > > >
> > > > For Example,
> > > >
> > > > I've a report which takes 3 parameters. Date1,Date2,EmpID.
> > > >
> > > > The report has to send to only one user thru depending on the EmpID
> > > parameter. How can I specify the query while creating the subscription?.
> > > >
> > > > If this can not be done thru subscription. Can this can be done on
> > > DeliveryExtension. Any code samples?.
> > > >
> > > > Any help would be much appreciated!.
> > > >
> > > > Thanks in advance.
> > > >
> > >
> > >
> > >
>
>

Email or Pop-up Notification for Unscheduled SQL Server Shutdown

How do I go about creating a notification for unscheduled Server Shutdowns?Hi
Implement a monitoring tool like BigBrother, Tivoli or one of the tools from
Quest Software.
You could also write on and have it run as a service on the server,
listening for WMI events.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"tim" <tim@.discussions.microsoft.com> wrote in message
news:DFEAF0E6-CD4E-4E9C-8817-583CEC6BF70D@.microsoft.com...
> How do I go about creating a notification for unscheduled Server
> Shutdowns?|||There is always the possibility to check your application event log or write
a trigger on some events
But what if your server got suddenly unplugged?
Med Bouchenafa
"tim" <tim@.discussions.microsoft.com> wrote in message
news:DFEAF0E6-CD4E-4E9C-8817-583CEC6BF70D@.microsoft.com...
> How do I go about creating a notification for unscheduled Server
> Shutdowns?

Email or Pop-up Notification for Unscheduled SQL Server Shutdown

How do I go about creating a notification for unscheduled Server Shutdowns?
Hi
Implement a monitoring tool like BigBrother, Tivoli or one of the tools from
Quest Software.
You could also write on and have it run as a service on the server,
listening for WMI events.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"tim" <tim@.discussions.microsoft.com> wrote in message
news:DFEAF0E6-CD4E-4E9C-8817-583CEC6BF70D@.microsoft.com...
> How do I go about creating a notification for unscheduled Server
> Shutdowns?
|||There is always the possibility to check your application event log or write
a trigger on some events
But what if your server got suddenly unplugged?
Med Bouchenafa
"tim" <tim@.discussions.microsoft.com> wrote in message
news:DFEAF0E6-CD4E-4E9C-8817-583CEC6BF70D@.microsoft.com...
> How do I go about creating a notification for unscheduled Server
> Shutdowns?

Email or Pop-up Notification for Unscheduled SQL Server Shutdown

How do I go about creating a notification for unscheduled Server Shutdowns?Hi
Implement a monitoring tool like BigBrother, Tivoli or one of the tools from
Quest Software.
You could also write on and have it run as a service on the server,
listening for WMI events.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"tim" <tim@.discussions.microsoft.com> wrote in message
news:DFEAF0E6-CD4E-4E9C-8817-583CEC6BF70D@.microsoft.com...
> How do I go about creating a notification for unscheduled Server
> Shutdowns?|||There is always the possibility to check your application event log or write
a trigger on some events
But what if your server got suddenly unplugged?
--
Med Bouchenafa
"tim" <tim@.discussions.microsoft.com> wrote in message
news:DFEAF0E6-CD4E-4E9C-8817-583CEC6BF70D@.microsoft.com...
> How do I go about creating a notification for unscheduled Server
> Shutdowns?

Monday, March 19, 2012

Email format for Reporting Services

Hi, this question is related to Reporting Services on SQL Server 2000. When creating a report and setting it to send via email as an attached excel spreadsheet, the email is in the format HTML. Does anyone know if it possible to default this format to something else like Rich Text. I have a feeling that this might involve a change to the RSEmailDPConfiguration within the RSReportServer.config file but am not sure which tag needs changing or adding.

Any help/suggestions greatfully received.According to documentation:

rsreportserver.config

EmbeddedRenderFormats

Specifies the rendering format used to encapsulate a report within the body

of an e-mail message. Images within the report are subsequently embedded within

the report. Valid values are MHTML and HTML4.0.

Does not look like you'll get Rich Text in an email without some custom code.

cheers,
Andrew|||

RTF is not supported by out-of-the-box RS. Theoretically you can write your own renderer but it's a difficult task, plus then you'll need to write custom delivery provider to support it as well. Support for RTF is in the wish list for the next RS version.

|||Thanks for both of your comments. I had a feelling it might be a custom option.

Friday, February 24, 2012

Eliminate Blank Spaces Between Cross-tabs

Hi.
I am developing our company's inventory application. I am creating a report that involves a cross-tab and subreport. We are using VB 2005 on which the Crystal Report is integrated.

I placed my cross-tab in the Group Header Section, and the subreport, also containing a crosstab in the Group Footer Section. Logically, it works properly but i cannot get rid of the blank spaces in between the cross-tab and subreport.

I have already checked all the properties of the sections. like suppressing those sections that are not included. But still, the blank spaces are there.
Please extend help on this matter. Thanks!What section is the space attributed to in the preview?|||Hello.

I suspect that the blank spaces are generated within the Group Header Section, wherein the cross-tab is placed.

Sunday, February 19, 2012

efficiently creating random numbers in very large table

Hello,

I need to sample data in a very large table in SQL Server 2000 (a gazillion rows of Performance Monitor statitics).

I'd like to take the top 5%, for instance, based upon a column containing random numbers.

Can anyone suggest a highly efficient method of populating a column with random numbers.

Thanks in advance.

Rodselect TOP 5 PERCENT * from [YourTable] order by newid()|||select TOP 5 PERCENT * from [YourTable] order by newid()

Thank you, I'll give that a go.

Regards,

Rod|||that won't populate your table with any random numbers obviously.

it will give you a random 5% slice of the table. a different slice each time you run it.|||Thanks, Good point; maybe I can have another column to set a bit , so that I can reproduce. I'll have to test performance, perhaps someone has some experience with this or have a different technique to propose. Thank you.

Rod|||If you really want a column of random values, then just create a GUID column with a default of NEWID(). But this won't give you a random sample every time, of course.|||If you really want a column of random values, then just create a GUID column with a default of NEWID(). But this won't give you a random sample every time, of course.

That's ok blindman, I just neede something that's efficient in terms populating random values. Regards, Rod|||just create a GUID column with a default of NEWID()
Ofcourse this works but if your table is really that big beware of the time it takes to alter the table! SQL Server has to expand each record so numerous page splits will occur, indexes will have to be rebuild, etc, etc. This could take a couple of hours.|||Ofcourse this works but if your table is really that big beware of the time it takes to alter the table! SQL Server has to expand each record so numerous page splits will occur, indexes will have to be rebuild, etc, etc. This could take a couple of hours.

...ugh.. Thanks. There does not seem to be a really efficient way of doing this...

Thanks for you input. Rod|||how many rows is the table?

also, you can generate random numbers in sql using rand() if you don't like guids. if a random number from 0-255 is sufficient you could store it in a tinyint and less page splits would result.

this code ran in 31 sec on my dev box. not great, but it is what it is:

set nocount on
declare @.t table (RandomColumn tinyint)
declare @.i int
set @.i=0

while @.i < 1000000
begin
insert into @.t select round(rand() * 255, 0)
set @.i = @.i + 1
end|||how many rows is the table?

also, you can generate random numbers in sql using rand() if you don't like guids. if a random number from 0-255 is sufficient you could store it in a tinyint and less page splits would result.

this code ran in 31 sec on my dev box. not great, but it is what it is:

set nocount on
declare @.t table (RandomColumn tinyint)
declare @.i int
set @.i=0

while @.i < 1000000
begin
insert into @.t select round(rand() * 255, 0)
set @.i = @.i + 1
end

That maybe ok, you're right, not great but maybe we can live that. Thanks for your code.

Regards,

Rod

Wednesday, February 15, 2012

Editing views in 2005 Management Studio

It was always the custom in Enterprise Manager, when creating a view, to
create a dummy view, e.g.:
SELECT 1
save it, then go back and edit the view. This way, you could edit the view
definition without Enterprise Manager destroying your formatting, and you
can add comments.
Now using "Microsoft SQL Server Management Studio", there is no longer a
"Properties" option if i right-click a view name.
So where is the option to edit a vew in MS?
(Is "MS" what we're abbreviating "Management Studio" these days?)Right click the view name in Management Studio and select Modify from
the context sensitive pop-up menu. Personally I always write creation &
alter scripts for every DDL object I create - that way you don't have
some GUI changing all your formatting etc. (also it's good for getting
the DDL syntax in your head).
I think Management Studio is commonly abbreviated SSMS (SQL Server
Management Studio). It seems to be the way Microsoft have marketed the
SQL 2005 products:
SSMS - SQL Server Management Studio
SSAS - SQL Server Analysis Service
SSIS - SQL Server Integration Services
SSRS - SQL Server Reporting Services (although I've often seen this as
just RS)
etc.
Although now that I think about it I've never seen Service Broker
abbreviated and I've seen Reporting & Notification Services abbreviated
as RS & NS (in fact I can't remember ever seeing Notification Services
abbreviated SSNS). Hmmm...
*mike hodgson*
http://sqlnerd.blogspot.com
Ian Boyd wrote:

>It was always the custom in Enterprise Manager, when creating a view, to
>create a dummy view, e.g.:
> SELECT 1
>save it, then go back and edit the view. This way, you could edit the view
>definition without Enterprise Manager destroying your formatting, and you
>can add comments.
>Now using "Microsoft SQL Server Management Studio", there is no longer a
>"Properties" option if i right-click a view name.
>
>So where is the option to edit a vew in MS?
>(Is "MS" what we're abbreviating "Management Studio" these days?)
>
>|||Do you mean using the query building tool? If you just want to edit in
text, click on Script View, Create As, To New Query Window and edit it
there. I tend to do that with all objects in SSMS
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Ian Boyd" <admin@.SWIFTPA.NET> wrote in message
news:OWljNm4KGHA.3984@.TK2MSFTNGP14.phx.gbl...
> It was always the custom in Enterprise Manager, when creating a view, to
> create a dummy view, e.g.:
> SELECT 1
> save it, then go back and edit the view. This way, you could edit the view
> definition without Enterprise Manager destroying your formatting, and you
> can add comments.
> Now using "Microsoft SQL Server Management Studio", there is no longer a
> "Properties" option if i right-click a view name.
>
> So where is the option to edit a vew in MS?
> (Is "MS" what we're abbreviating "Management Studio" these days?)
>|||Not completely. BIDS is Business Intelligence Studio (though it could be
SSBIDS :)
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message
news:%23f$o554KGHA.1312@.TK2MSFTNGP09.phx.gbl...
Right click the view name in Management Studio and select Modify from the
context sensitive pop-up menu. Personally I always write creation & alter
scripts for every DDL object I create - that way you don't have some GUI
changing all your formatting etc. (also it's good for getting the DDL syntax
in your head).
I think Management Studio is commonly abbreviated SSMS (SQL Server
Management Studio). It seems to be the way Microsoft have marketed the SQL
2005 products:
SSMS - SQL Server Management Studio
SSAS - SQL Server Analysis Service
SSIS - SQL Server Integration Services
SSRS - SQL Server Reporting Services (although I've often seen this as just
RS)
etc.
Although now that I think about it I've never seen Service Broker
abbreviated and I've seen Reporting & Notification Services abbreviated as
RS & NS (in fact I can't remember ever seeing Notification Services
abbreviated SSNS). Hmmm...
mike hodgson
http://sqlnerd.blogspot.com
Ian Boyd wrote:
It was always the custom in Enterprise Manager, when creating a view, to
create a dummy view, e.g.:
SELECT 1
save it, then go back and edit the view. This way, you could edit the view
definition without Enterprise Manager destroying your formatting, and you
can add comments.
Now using "Microsoft SQL Server Management Studio", there is no longer a
"Properties" option if i right-click a view name.
So where is the option to edit a vew in MS?
(Is "MS" what we're abbreviating "Management Studio" these days?)|||"Mike Hodgson" <e1minst3r@.gmail.com> wrote in message
news:%23f$o554KGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Right click the view name in Management Studio and select Modify from
> the context sensitive pop-up menu. Personally I always write creation &
> alter scripts for every DDL object I create - that way you don't have
> some GUI changing all your formatting etc. (also it's good for getting
> the DDL syntax in your head).
That doesn't work. It shows me the SQL of the view, but not the view
defintion itself. And if i modify the SQL formatting, or add comments, the
formatting is destroyed and comments are removed.
Any other suggestions?|||> Do you mean using the query building tool? If you just want to edit in
> text, click on Script View, Create As, To New Query Window and edit it
> there. I tend to do that with all objects in SSMS
i want the equivalent of Enterprise Manager's
Right-Click->Properties
i don't want to have to script the view, and then run a drop-create.
Everyone, it's okay to admit that it cannot be done in SSMS.|||> Everyone, it's okay to admit that it cannot be done in SSMS.
Sorry, just trying to figure out what you want and fit an answer to your
request.
If you are asking is the paradigm of SSMS the same as EM. No, not at all.
(And I don't like query editors at all, so I would never have used it in EM
either.) SSMS uses an editing paradigm of files, and you start one by
scripting objects to the file.
Instead of scripting it as CREATE, script is as ALTER and you can save
changes by just executing the batch.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Ian Boyd" <ian.msnews010@.avatopia.com> wrote in message
news:eWlEZi$KGHA.1236@.TK2MSFTNGP10.phx.gbl...
> i want the equivalent of Enterprise Manager's
> Right-Click->Properties
> i don't want to have to script the view, and then run a drop-create.
> Everyone, it's okay to admit that it cannot be done in SSMS.
>|||"Louis Davidson" <dr_dontspamme_sql@.hotmail.com> wrote in message
news:ellSfRALGHA.2780@.tk2msftngp13.phx.gbl...
> If you are asking is the paradigm of SSMS the same as EM. No, not at all.
> (And I don't like query editors at all, so I would never have used it in
> EM either.)
i also don't like query editors, and always created and edited view DDL
directly

> Sorry, just trying to figure out what you want and fit an answer to your
> request.
...which was different from Right-Click->Design View|||Yeah, OK. Looks like the Modify menu option is about as close as SSMS
gets to the old SQLEM view properties. But you're right - it reformats
stuff (don't you hate it when tools do that!).
The easiest thing for you to do (doesn't require hand-crafting scripts)
is to just right click the view name and select Script View As | ALTER
To | New Query Editor Window. That will automatically generate the
ALTER VIEW script for you from the actual view schema (ie. it'll keep
whatever comments & whitespace were in the code). All you have to do is
change the bits you want changed and then execute the ALTER VIEW
statement. You don't even have to save the script if you don't want
(although, personally, I would always keep a record of what I changed in
the DDL). And since it's an ALTER statement it'll keep dependencies,
permissions & all those other things that tend to disappear and get
forgotten when you DROP VIEW... CREATE VIEW...
That's about as close as I can suggest to simulate the old View
Properties dialog box in SQLEM.
*mike hodgson*
http://sqlnerd.blogspot.com
Ian Boyd wrote:

>"Louis Davidson" <dr_dontspamme_sql@.hotmail.com> wrote in message
>news:ellSfRALGHA.2780@.tk2msftngp13.phx.gbl...
>
>i also don't like query editors, and always created and edited view DDL
>directly
>
>
>
>
>...which was different from Right-Click->Design View
>
>|||use Script as Alter.
EM scripts the view to the properties window using a CREATE, so it ran a
drop-create under the hood, and restored permissions.
The only thing the properties window gave you that scripting doesn't is
the permissions button.
But if you script as alter instead, you don't have to worry about losing
permissions, so that's moot.
The advantages of having the script (you can search, it's not a modal
window, it's far easier to read, you can save to a file directly from
it, etc.) far outweight the EM properties window. [i rap knuckles around
here when i see people using EM props window :)]
Ian Boyd wrote:
>
> i want the equivalent of Enterprise Manager's
> Right-Click->Properties
> i don't want to have to script the view, and then run a drop-create.
> Everyone, it's okay to admit that it cannot be done in SSMS.
>