Showing posts with label save. Show all posts
Showing posts with label save. Show all posts

Wednesday, March 28, 2012

how to save xml document in database table?

I have a db in Sql Server Express 2005. Into this db I have a table with an XML field and I want to save an XML document into this field through SQL.
Any suggestion to do this operation?
Thank you

Mirko

There is a nice article about XML fields and SQL server.

http://www.developer.com/db/article.php/3565996

However there is a problem on that article I'll paste the insert statements here:

INSERT INTO Document (Description, DocumentStore)
VALUES('Bruce''s poem',
N'<?xml version="1.0" ?>
<Document Name="Poem">
<Author>Bruce</Author>
<Text>The cat/is flat.</Text>
</Document>')

INSERT INTO Document (Description, DocumentStore)
VALUES('Code of Hammurabi',
N'<?xml version="1.0" ?>
<Document Name="Code">
<Author>Hammurabi</Author>
<Text>An eye for an eye, a tooth for a tooth.</Text>
</Document>')

INSERT INTO Document (Description, DocumentStore)
VALUES('Nursery Rhyme',
N'<?xml version="1.0" ?>
<Document Name="Jack and Jill">
<Author>Mother Hubbard</Author>
<Text>Jack and Jill/went up the hill.</Text>
</Document>')

|||

Thank you!

Mirko

how to save xml document in database table?

I have a db in Sql Server Express 2005. Into this db I have a table with an XML field and I want to save an XML document into this field through SQL.
Any suggestion to do this operation?
Thank you

Mirko

There is a nice article about XML fields and SQL server.

http://www.developer.com/db/article.php/3565996

However there is a problem on that article I'll paste the insert statements here:

INSERT INTO Document (Description, DocumentStore)
VALUES('Bruce''s poem',
N'<?xml version="1.0" ?>
<Document Name="Poem">
<Author>Bruce</Author>
<Text>The cat/is flat.</Text>
</Document>')

INSERT INTO Document (Description, DocumentStore)
VALUES('Code of Hammurabi',
N'<?xml version="1.0" ?>
<Document Name="Code">
<Author>Hammurabi</Author>
<Text>An eye for an eye, a tooth for a tooth.</Text>
</Document>')

INSERT INTO Document (Description, DocumentStore)
VALUES('Nursery Rhyme',
N'<?xml version="1.0" ?>
<Document Name="Jack and Jill">
<Author>Mother Hubbard</Author>
<Text>Jack and Jill/went up the hill.</Text>
</Document>')

|||

Thank you!

Mirko

how to save trigger into table in sql 2005

I have found the node for Triggers in SQL Server 2005's Management Studio and tried to create a 'New Trigger...' but when I save, it saves it to an .sql file but do not attach it to the table.

What am I doing wrong here? I can't seem to attach it. And where is this Assisted Editor ...i can't seem to find it anywhere

creating a trigger is like any other sql statement. You can execute them against a database or you can save the script for later use. You want to execute the statement so instead of hitting save try the execute button or hitting F5

|||

THANK YOU SO MUCH, I MADE IT.Big Smile

sql

How to save the SP result?

Hi!
How can i save the resultant recordset generated by an Stored Procedure to
another table (with the same structure) ?
I think its some like INSERT * INTO tmptable FROM **Exec mySProc**
Can you help my?
Thanxs, Gabriel.Hi Gabriel
You're close...
You just don't need the * or the FROM.
Make sure the Stored Proc only returns one set of rows.
INSERT INTO tmptable
EXEC myProc
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Gabriel South" <gsouth@.hotmail.com> wrote in message
news:Ore5y9iBFHA.2984@.TK2MSFTNGP11.phx.gbl...
> Hi!
> How can i save the resultant recordset generated by an Stored Procedure to
> another table (with the same structure) ?
> I think its some like INSERT * INTO tmptable FROM **Exec mySProc**
> Can you help my?
> Thanxs, Gabriel.
>
>

How to save the parameters to a RS report

I have several RS reports which have a number of parameters like
Company Code, Plant, Movement type, GL Accounts, Period, Material type,
Material,etc.
Sometimes each user runs the report with the same selection except that
they change something like the period for which the report is run. Is
there a way we can provide a mechanism to the users to save the
parameters for the reports and retrieve the parameter settings for a
report and modify and run them. We can do this in Business objects.
Thanks
Kareni think you are looking for the subscriptions feature in Report Manager.
Click on a report. Next click "subscriptions" near the top. You can now
setup a subscription with different parameters.
Taz
"KarenM" <karenmiddleol@.yahoo.com> wrote in message
news:1158489967.873086.53010@.d34g2000cwd.googlegroups.com...
>I have several RS reports which have a number of parameters like
> Company Code, Plant, Movement type, GL Accounts, Period, Material type,
> Material,etc.
> Sometimes each user runs the report with the same selection except that
> they change something like the period for which the report is run. Is
> there a way we can provide a mechanism to the users to save the
> parameters for the reports and retrieve the parameter settings for a
> report and modify and run them. We can do this in Business objects.
> Thanks
> Karen
>|||Hi Tarun,
No I know of subscriptions that is when I expect the report to run in
background. What I am looking for is if users run the same report many
times with a specific parameters it is not convenient for them to type
them everytime they would like to save the parameters and retrieve and
use them
Thanks
Karen
Tarun Mistry wrote:
> i think you are looking for the subscriptions feature in Report Manager.
> Click on a report. Next click "subscriptions" near the top. You can now
> setup a subscription with different parameters.
> Taz
>
> "KarenM" <karenmiddleol@.yahoo.com> wrote in message
> news:1158489967.873086.53010@.d34g2000cwd.googlegroups.com...
> >I have several RS reports which have a number of parameters like
> > Company Code, Plant, Movement type, GL Accounts, Period, Material type,
> > Material,etc.
> >
> > Sometimes each user runs the report with the same selection except that
> > they change something like the period for which the report is run. Is
> > there a way we can provide a mechanism to the users to save the
> > parameters for the reports and retrieve the parameter settings for a
> > report and modify and run them. We can do this in Business objects.
> >
> > Thanks
> > Karen
> >|||This is not a feature that is included in the product.
We created a system that did this. The first step is that you have to
create your own Visual Studio application that you will use for
reporting, probably including a ReportViewer control.
You would create your own fields on the screen to accept these
parameters.
Then you would have to create a system for saving the reports.
We collected all the paramters into an xml string and saved it to a
table, along with a userID and a name the user gave to the particular
parameter set.
KarenM wrote:
> Hi Tarun,
> No I know of subscriptions that is when I expect the report to run in
> background. What I am looking for is if users run the same report many
> times with a specific parameters it is not convenient for them to type
> them everytime they would like to save the parameters and retrieve and
> use them
> Thanks
> Karen
> Tarun Mistry wrote:
> > i think you are looking for the subscriptions feature in Report Manager.
> >
> > Click on a report. Next click "subscriptions" near the top. You can now
> > setup a subscription with different parameters.
> >
> > Taz
> >
> >
> > "KarenM" <karenmiddleol@.yahoo.com> wrote in message
> > news:1158489967.873086.53010@.d34g2000cwd.googlegroups.com...
> > >I have several RS reports which have a number of parameters like
> > > Company Code, Plant, Movement type, GL Accounts, Period, Material type,
> > > Material,etc.
> > >
> > > Sometimes each user runs the report with the same selection except that
> > > they change something like the period for which the report is run. Is
> > > there a way we can provide a mechanism to the users to save the
> > > parameters for the reports and retrieve the parameter settings for a
> > > report and modify and run them. We can do this in Business objects.
> > >
> > > Thanks
> > > Karen
> > >|||That is exactly what we are after. Could you kindly share the code for
the same. It is such a vital requirement for users I am surprised that
Microsoft missed including this in one of the RS support packs.
Thanks
Karen
cowznofsky wrote:
> This is not a feature that is included in the product.
> We created a system that did this. The first step is that you have to
> create your own Visual Studio application that you will use for
> reporting, probably including a ReportViewer control.
> You would create your own fields on the screen to accept these
> parameters.
> Then you would have to create a system for saving the reports.
> We collected all the paramters into an xml string and saved it to a
> table, along with a userID and a name the user gave to the particular
> parameter set.
> KarenM wrote:
> > Hi Tarun,
> >
> > No I know of subscriptions that is when I expect the report to run in
> > background. What I am looking for is if users run the same report many
> > times with a specific parameters it is not convenient for them to type
> > them everytime they would like to save the parameters and retrieve and
> > use them
> >
> > Thanks
> > Karen
> > Tarun Mistry wrote:
> > > i think you are looking for the subscriptions feature in Report Manager.
> > >
> > > Click on a report. Next click "subscriptions" near the top. You can now
> > > setup a subscription with different parameters.
> > >
> > > Taz
> > >
> > >
> > > "KarenM" <karenmiddleol@.yahoo.com> wrote in message
> > > news:1158489967.873086.53010@.d34g2000cwd.googlegroups.com...
> > > >I have several RS reports which have a number of parameters like
> > > > Company Code, Plant, Movement type, GL Accounts, Period, Material type,
> > > > Material,etc.
> > > >
> > > > Sometimes each user runs the report with the same selection except that
> > > > they change something like the period for which the report is run. Is
> > > > there a way we can provide a mechanism to the users to save the
> > > > parameters for the reports and retrieve the parameter settings for a
> > > > report and modify and run them. We can do this in Business objects.
> > > >
> > > > Thanks
> > > > Karen
> > > >

How to save the " character in a CDATA in SQL SErver 2005

Dear Pals,

I know that special characters, such as <, in a cdata section will be converted properly into entity reference before getting stored in a xml field in the database.

However, it seems that the character " (quotation) does not get converted to &quot;. This would result in problems when the XML document is fetched.

For example, a xml document like:

<A><![CDATA[THis is "John"]]></A>

when stored, it becomes

<A>THis is "John"</A>

This of course causes problem for XML parsers.

IS there any cure for that problem.

Thanks

Feng-Hsu Wang

Feng-Hsu,

According to the XML spec:

The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings " &amp; " and " &lt; " respectively. The right angle bracket (>) may be represented using the string " &gt; ", and MUST, for compatibility, be escaped using either " &gt; " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end of a CDATA section.

In the content of elements, character data is any string of characters which does not contain the start-delimiter of any markup and does not include the CDATA-section-close delimiter, " ]]> ". In a CDATA section, character data is any string of characters not including the CDATA-section-close delimiter, " ]]> ".

To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character (') may be represented as " &apos; ", and the double-quote character (") as " &quot; ".

As I understand the XML spec, a single quote and a double quote character does not need to be escaped inside an element value. They only need to be escaped inside an attribute value.

So, this should not be causing any problems for XML parsers.

Jimmy Wu

|||

<A>THis is "John"</A>

is well-formed xml. That means it is following all the syntax rules for xml. If you are getting an error from an xml parser reading this then that parser is broken.

Dan

sql

how to save stored procedures on sql express server

Hi Guys

I have visual web developer and sqlexpress 2005 installed on my windows XP pro.

I am creating stored procedures through VWD and works fine for me. However today I realize I do not know how to create stored procedures through sqlexpress server managment.

When I try it it wants to save it as file. And if I do that I am not able to see them until manually open each .sql file.

so, could you enlighten me little please.

thanks
Cemal

hi Cemal,

Cemal wrote:

Hi Guys

I have visual web developer and sqlexpress 2005 installed on my windows XP pro.

I am creating stored procedures through VWD and works fine for me. However today I realize I do not know how to create stored procedures through sqlexpress server managment.

When I try it it wants to save it as file. And if I do that I am not able to see them until manually open each .sql file.

the "disk" button states to actually save the text inside the query window... you can type (or cut&paste) some text, whatever thext in whatever language, and you can later save that text into a file...

when you have to create a stored procedure, you have to execute the data definition language statements defining that object.. so, say you have a text like

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_my_stored_procedure]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[usp_my_stored_procedure]; GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[usp_my_stored_procedure] AS BEGIN /**/ /*Author:xxx yyy zzz*/ /*Date:14/07/2007*/ /*Modified:__/__/_*/ /**/ /*Please report suggestions/comments/bugs/feedback to:*/ /*me@.me.com*/ /**/ /* - */ /*this procedure perform these tasks...*/ /**/ DECLARE @.msg varchar(1000); BEGIN TRY SET NOCOUNT ON; SELECT col_list FROM [dbo].[my_table]; RETURN 0; END TRY BEGIN CATCH -- returns the occured exception DECLARE @.ErrorMSG varchar(2000); SET @.ErrorMSG = ERROR_MESSAGE() RAISERROR (@.ErrorMSG, 16, 1); RETURN -100 END CATCH END; GO

you have to execute it in order to "save" it within the database it belongs... to execute it, press the F5 key or the toolbarbutton with the "! Execute" mark...

regards

|||As this is a common misunderstanding, I once did a screencast for that, available on my site:

How to alter a stored procedure within SSMS: Difference between saving and executing a modified stored procedure

Jens K. Suessmeyer.

http://www.sqlserver2005.de

How to save SQL 2005 solution?

Hi,
I have a solution within SQL 2005, which contains scripts of all
stored procs and views so that they are in source control. My
question is, how can I save this so that every time I open up SQL 2005
management strudio, it appears in the right hand pane, instead of
having to open it up every time.
Thanks for any assistance.How about having a shortcut for the sln file on your desktop?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"nomad" <d.bedgood@.ntlworld.com> wrote in message
news:1172157510.539730.34010@.k78g2000cwa.googlegroups.com...
> Hi,
> I have a solution within SQL 2005, which contains scripts of all
> stored procs and views so that they are in source control. My
> question is, how can I save this so that every time I open up SQL 2005
> management strudio, it appears in the right hand pane, instead of
> having to open it up every time.
> Thanks for any assistance.
>|||On Feb 22, 3:29 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> How about having a shortcut for the sln file on your desktop?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://www.solidqualitylearning.com/
> "nomad" <d.bedg...@.ntlworld.com> wrote in message
> news:1172157510.539730.34010@.k78g2000cwa.googlegroups.com...
> > Hi,
> > I have a solution within SQL 2005, which contains scripts of all
> > stored procs and views so that they are in source control. My
> > question is, how can I save this so that every time I open up SQL 2005
> > management strudio, it appears in the right hand pane, instead of
> > having to open it up every time.
> > Thanks for any assistance.
Is that the only way? Also, it is very slow loading them all. Think
I might just stick to using souce safe without the solution.

How to save SQL 2005 solution?

Hi,
I have a solution within SQL 2005, which contains scripts of all
stored procs and views so that they are in source control. My
question is, how can I save this so that every time I open up SQL 2005
management strudio, it appears in the right hand pane, instead of
having to open it up every time.
Thanks for any assistance.How about having a shortcut for the sln file on your desktop?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"nomad" <d.bedgood@.ntlworld.com> wrote in message
news:1172157510.539730.34010@.k78g2000cwa.googlegroups.com...
> Hi,
> I have a solution within SQL 2005, which contains scripts of all
> stored procs and views so that they are in source control. My
> question is, how can I save this so that every time I open up SQL 2005
> management strudio, it appears in the right hand pane, instead of
> having to open it up every time.
> Thanks for any assistance.
>|||On Feb 22, 3:29 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> How about having a shortcut for the sln file on your desktop?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://www.solidqualitylearning.com/
> "nomad" <d.bedg...@.ntlworld.com> wrote in message
> news:1172157510.539730.34010@.k78g2000cwa.googlegroups.com...
>
>
>
Is that the only way? Also, it is very slow loading them all. Think
I might just stick to using souce safe without the solution.

how to save result of sql query to .csv file "using command in sql query itself"

Hello there

I m new in sql..i want to know wether above said task is possible in sql?

if yes then what is exact format of sql query command..

Thanks

AVD

YOu can have a look in the BOL for OPENDATASOURCE, there should a sample for an output to a propetary format.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

How to Save Report Parameters

I am trying to design a C# .NET web application that allows the user to run
a report, then save the report parameters so that when they open it again,
they get the same parameters with refreshed data.
I think my design should go something like this:
1) Render the report using the web service
2) make a button or something for the user to save the report
3) When the user clicks the save report button, call a web service method to
retrieve the report ParameterValue[] collection of parameter values that
were last used to run the report.
4) Save the ParameterValue[] collection into a DB table
5) when the user goes back to the report, load the ParameterValue[]
collection back from the DB table and render the report with the saved
parameters
How do I accomplish step (3)'
I looked at the ReportingService.GetReportParameters Method, but it does not
return the parameter values! It just returns a collection of ReportParameter
objects, which have no properties for the current values of a report. This
is just a listing of report parameters defined for a report, not what their
current values are in the current session.
The only methods that return a ParameterValue[] collection are the
GetDataDrivenSubscriptionProperties and GetSubscriptionProperties methods.
Does this mean I have to create a subscription before I can retrieve the
values?
I also see that the Render method does return a ParameterValue[] collection
as an output parameter, but only if the report is being rendered as a Report
History Snapshot! Do I have to create a snapshot every time just to store
the report parameters?
The only other thing I can think of is to write my own code to display the
parameters and code my own "view report" button, so that I can manually
store the parameter values... I don't want to resort to this!! :-P
Please point me in the right direction, and I will follow up.
MalikTry this (I'm using VB.Net syntax)
Dim ReportParameters(Number of Parameters defined in your report) as
ParameterValue
Dim iCount as Integer
'Retrieve your parameter values from the database.
'Assume two parameters from this example.
For iCount = 1 to ReportParameters.Length
ReportParameters(iCount - 1) = New ParameterValue
Select Case iCount
Case 1
ReportParameters(iCount - 1).Name = "The name of your report parameter
defined in your report"
ReportParameters(iCount - 1).value = "Value from your database"
Case 2
ReportParameters(iCount - 1).Name = "The name of your report parameter
defined in your report"
ReportParameters(iCount - 1).value = "Value from your database"
End Select
Next
Once you have defined all of your report parameters, you can use
ReportParameters in the render method, and your report will have the last
values that were used in the report you are viewing.
"Abdul Malik Said" wrote:
> I am trying to design a C# .NET web application that allows the user to run
> a report, then save the report parameters so that when they open it again,
> they get the same parameters with refreshed data.
> I think my design should go something like this:
> 1) Render the report using the web service
> 2) make a button or something for the user to save the report
> 3) When the user clicks the save report button, call a web service method to
> retrieve the report ParameterValue[] collection of parameter values that
> were last used to run the report.
> 4) Save the ParameterValue[] collection into a DB table
> 5) when the user goes back to the report, load the ParameterValue[]
> collection back from the DB table and render the report with the saved
> parameters
> How do I accomplish step (3)'
> I looked at the ReportingService.GetReportParameters Method, but it does not
> return the parameter values! It just returns a collection of ReportParameter
> objects, which have no properties for the current values of a report. This
> is just a listing of report parameters defined for a report, not what their
> current values are in the current session.
> The only methods that return a ParameterValue[] collection are the
> GetDataDrivenSubscriptionProperties and GetSubscriptionProperties methods.
> Does this mean I have to create a subscription before I can retrieve the
> values?
> I also see that the Render method does return a ParameterValue[] collection
> as an output parameter, but only if the report is being rendered as a Report
> History Snapshot! Do I have to create a snapshot every time just to store
> the report parameters?
> The only other thing I can think of is to write my own code to display the
> parameters and code my own "view report" button, so that I can manually
> store the parameter values... I don't want to resort to this!! :-P
> Please point me in the right direction, and I will follow up.
> Malik
>
>|||Mike,
Thanks a lot for your help.
I guess I was not clear in my stating of "Step 3", which was to determine
which parameters the user last used to run the report. By this, I meant to
say:
How can I programmatically get from the report object model which parameters
were last used to run the report? I have to get these first before I can
store them in the database. Retrieving them and reconstituting them is not
difficult after they are saved. The problem is, how do I find the values in
the first place?
Here is a better description:
The user clicks "View Report" from the parameters toolbar
The user clicks "Save Report" button which I have made elsewhere on the page
In the code for the "Save Report" button, how do I reference the parameter
values that were last chosen? I need to get these values from the report
first, before I can store them in the database. This is what I don't know
how to do.
Any more help would be greatly appreciated.
Malik
"Mike Collins" <MikeCollins@.discussions.microsoft.com> wrote in message
news:B8C4E6E5-5AA7-4D8F-8CB3-2B01387392B4@.microsoft.com...
> Try this (I'm using VB.Net syntax)
> Dim ReportParameters(Number of Parameters defined in your report) as
> ParameterValue
> Dim iCount as Integer
> 'Retrieve your parameter values from the database.
> 'Assume two parameters from this example.
> For iCount = 1 to ReportParameters.Length
> ReportParameters(iCount - 1) = New ParameterValue
> Select Case iCount
> Case 1
> ReportParameters(iCount - 1).Name = "The name of your report
parameter
> defined in your report"
> ReportParameters(iCount - 1).value = "Value from your database"
> Case 2
> ReportParameters(iCount - 1).Name = "The name of your report
parameter
> defined in your report"
> ReportParameters(iCount - 1).value = "Value from your database"
> End Select
> Next
> Once you have defined all of your report parameters, you can use
> ReportParameters in the render method, and your report will have the last
> values that were used in the report you are viewing.
> "Abdul Malik Said" wrote:
> > I am trying to design a C# .NET web application that allows the user to
run
> > a report, then save the report parameters so that when they open it
again,
> > they get the same parameters with refreshed data.
> >
> > I think my design should go something like this:
> >
> > 1) Render the report using the web service
> > 2) make a button or something for the user to save the report
> > 3) When the user clicks the save report button, call a web service
method to
> > retrieve the report ParameterValue[] collection of parameter values that
> > were last used to run the report.
> > 4) Save the ParameterValue[] collection into a DB table
> > 5) when the user goes back to the report, load the ParameterValue[]
> > collection back from the DB table and render the report with the saved
> > parameters
> >
> > How do I accomplish step (3)'
> >
> > I looked at the ReportingService.GetReportParameters Method, but it does
not
> > return the parameter values! It just returns a collection of
ReportParameter
> > objects, which have no properties for the current values of a report.
This
> > is just a listing of report parameters defined for a report, not what
their
> > current values are in the current session.
> >
> > The only methods that return a ParameterValue[] collection are the
> > GetDataDrivenSubscriptionProperties and GetSubscriptionProperties
methods.
> > Does this mean I have to create a subscription before I can retrieve the
> > values?
> >
> > I also see that the Render method does return a ParameterValue[]
collection
> > as an output parameter, but only if the report is being rendered as a
Report
> > History Snapshot! Do I have to create a snapshot every time just to
store
> > the report parameters?
> >
> > The only other thing I can think of is to write my own code to display
the
> > parameters and code my own "view report" button, so that I can manually
> > store the parameter values... I don't want to resort to this!! :-P
> >
> > Please point me in the right direction, and I will follow up.
> >
> > Malik
> >
> >
> >|||Hi Malik,
I've just completed an application which does exactly what you are
trying to do :) Mine does a little more like managing subscriptions,
schedules etc but the viewing and saving of the report/params is the
core of my app. I can't share the code as it's a commercial app but
will gladly help out with snippets etc :)
I did it the following way:
1/ Reports are already on the server so I loop through the selected
report and obtain all the params for that report. I then
enable/disable webusercontrols for each of the params on screen.
see code below to get the params from a report (formatting screwed by
newsreader :( )
private void GetSpecificReportParameters(string report)
{
if(rs == null) rs = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
ReportParameter[] parameters parameters =rs.GetReportParameters(report, null, false, null, null);
if (parameters != null)
{
string []nameArray = new string[50];
int i = 0;
foreach (ReportParameter rp in parameters)
{
// this is each of the names banged into an array
nameArray[i] = rp.Name;
i++;
}
// now loop through em and switch on/off the correct params
foreach (string str in nameArray)
{
if(str == null) // nothing so carry on
continue;
if(str.ToString() == "SurnameFrom")
{
SurnameWebUserControl.Visible = true;
}
// etc etc for all params found
}
}
}
2/ now i've got all the params for the report and the relevant
controls to fill in these params, my user can now set their params and
click on either View or Save report.
View builds up a string from the webusercontrols, appending the &
after each param & then passing this into the ReportViewer control on
the form.
Save does the same building of the string but instead of rendering to
the ReportViewer control, it simply saves to a database field along
with the path to the report i.e. heres one I've just created:
/Reports/MyReport&rs:Command=Render&rs:Format=HTML4.0&rc:Parameters=false&SurnameFrom=SMITH&SurnameTo=SMITH
When I recall the saved report, I simply pass that line in as the URL
prefixing the server address to it - then it's passed to the
ReportViewer control to render to screen.
Very simple and works very well - hope it makes sense to you. The
major advantage of this mechanism is that all we need to do is upload
a new report with params, the application will not need recompilation
in order to deal with the params (as long as no new params have been
added that the previous app knows nothing of!)
Si
On Fri, 20 Aug 2004 10:30:45 +0100, "Abdul Malik Said"
<diplacusis@.hotmNOSPAMail.com> wrote:
>Mike,
>Thanks a lot for your help.
>I guess I was not clear in my stating of "Step 3", which was to determine
>which parameters the user last used to run the report. By this, I meant to
>say:
>How can I programmatically get from the report object model which parameters
>were last used to run the report? I have to get these first before I can
>store them in the database. Retrieving them and reconstituting them is not
>difficult after they are saved. The problem is, how do I find the values in
>the first place?
>Here is a better description:
>The user clicks "View Report" from the parameters toolbar
>The user clicks "Save Report" button which I have made elsewhere on the page
>In the code for the "Save Report" button, how do I reference the parameter
>values that were last chosen? I need to get these values from the report
>first, before I can store them in the database. This is what I don't know
>how to do.
>Any more help would be greatly appreciated.
>Malik
>|||Hi Si,
That is a good way to solve this problem. If I understand what you are
doing, then it seems like you are basically writing your own code to replace
the parameter toolbar. This way, you know exactly what the values of the
controls are when the user clicks "save".
I could write a solution like this, but I was hoping there was a way of
doing it without developing code to replace the parameter selection toolbar.
Since there is already a parameter toolbar, I would like to use it. This
way, any report could be added to my application, since I wouldn't have to
assume anything about parameters.
I am currently trying to see if there is anything in the client-side
javascript generated for the report that will help me. I can see the current
report parameters there, but I am still trying to figure out how to retrieve
them properly...
Anyway, all of this has helped me think through my design, so many thanks
for your ideas.
Malik
"Si" <no@.spam.thanks> wrote in message
news:l9nbi052eoggh9ucpro71t1t72lbnou72i@.4ax.com...
> Hi Malik,
> I've just completed an application which does exactly what you are
> trying to do :) Mine does a little more like managing subscriptions,
> schedules etc but the viewing and saving of the report/params is the
> core of my app. I can't share the code as it's a commercial app but
> will gladly help out with snippets etc :)
> I did it the following way:
> 1/ Reports are already on the server so I loop through the selected
> report and obtain all the params for that report. I then
> enable/disable webusercontrols for each of the params on screen.
> see code below to get the params from a report (formatting screwed by
> newsreader :( )
> private void GetSpecificReportParameters(string report)
> {
> if(rs == null) rs = new ReportingService();
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> ReportParameter[] parameters parameters => rs.GetReportParameters(report, null, false, null, null);
> if (parameters != null)
> {
> string []nameArray = new string[50];
> int i = 0;
> foreach (ReportParameter rp in parameters)
> {
> // this is each of the names banged into an array
> nameArray[i] = rp.Name;
> i++;
> }
> // now loop through em and switch on/off the correct params
> foreach (string str in nameArray)
> {
> if(str == null) // nothing so carry on
> continue;
> if(str.ToString() == "SurnameFrom")
> {
> SurnameWebUserControl.Visible = true;
> }
> // etc etc for all params found
> }
> }
> }
>
> 2/ now i've got all the params for the report and the relevant
> controls to fill in these params, my user can now set their params and
> click on either View or Save report.
> View builds up a string from the webusercontrols, appending the &
> after each param & then passing this into the ReportViewer control on
> the form.
> Save does the same building of the string but instead of rendering to
> the ReportViewer control, it simply saves to a database field along
> with the path to the report i.e. heres one I've just created:
>
/Reports/MyReport&rs:Command=Render&rs:Format=HTML4.0&rc:Parameters=false&Su
rnameFrom=SMITH&SurnameTo=SMITH
> When I recall the saved report, I simply pass that line in as the URL
> prefixing the server address to it - then it's passed to the
> ReportViewer control to render to screen.
> Very simple and works very well - hope it makes sense to you. The
> major advantage of this mechanism is that all we need to do is upload
> a new report with params, the application will not need recompilation
> in order to deal with the params (as long as no new params have been
> added that the previous app knows nothing of!)
> Si
>
>
>
> On Fri, 20 Aug 2004 10:30:45 +0100, "Abdul Malik Said"
> <diplacusis@.hotmNOSPAMail.com> wrote:
> >Mike,
> >
> >Thanks a lot for your help.
> >
> >I guess I was not clear in my stating of "Step 3", which was to determine
> >which parameters the user last used to run the report. By this, I meant
to
> >say:
> >
> >How can I programmatically get from the report object model which
parameters
> >were last used to run the report? I have to get these first before I can
> >store them in the database. Retrieving them and reconstituting them is
not
> >difficult after they are saved. The problem is, how do I find the values
in
> >the first place?
> >
> >Here is a better description:
> >
> >The user clicks "View Report" from the parameters toolbar
> >The user clicks "Save Report" button which I have made elsewhere on the
page
> >
> >In the code for the "Save Report" button, how do I reference the
parameter
> >values that were last chosen? I need to get these values from the report
> >first, before I can store them in the database. This is what I don't know
> >how to do.
> >
> >Any more help would be greatly appreciated.
> >
> >Malik
> >|||No probs,
I still have the param toolbar there, it's just hidden using the
rc:Parameters=false tag in the url.
I understand what you are trying to achive but from my limited
understanding, it's currently not possible as there is no statefull
save of the params once the report is generated, only beforehand.
Si
On Fri, 20 Aug 2004 12:52:22 +0100, "Abdul Malik Said"
<diplacusis@.hotmNOSPAMail.com> wrote:
>Hi Si,
>That is a good way to solve this problem. If I understand what you are
>doing, then it seems like you are basically writing your own code to replace
>the parameter toolbar. This way, you know exactly what the values of the
>controls are when the user clicks "save".
>I could write a solution like this, but I was hoping there was a way of
>doing it without developing code to replace the parameter selection toolbar.
>Since there is already a parameter toolbar, I would like to use it. This
>way, any report could be added to my application, since I wouldn't have to
>assume anything about parameters.
>I am currently trying to see if there is anything in the client-side
>javascript generated for the report that will help me. I can see the current
>report parameters there, but I am still trying to figure out how to retrieve
>them properly...
>Anyway, all of this has helped me think through my design, so many thanks
>for your ideas.
>Malik
>|||If you come up with an elegant solution to this problem, I'd love to
hear about it (i.e. please share it with the group). We would also
very much like to be able to save and restore parameters without
reinventing the wheel (a.k.a. the parameter selection toolbar :-)
Brad.
On Fri, 20 Aug 2004 12:52:22 +0100, "Abdul Malik Said"
<diplacusis@.hotmNOSPAMail.com> wrote:
>Hi Si,
>That is a good way to solve this problem. If I understand what you are
>doing, then it seems like you are basically writing your own code to replace
>the parameter toolbar. This way, you know exactly what the values of the
>controls are when the user clicks "save".
>I could write a solution like this, but I was hoping there was a way of
>doing it without developing code to replace the parameter selection toolbar.
>Since there is already a parameter toolbar, I would like to use it. This
>way, any report could be added to my application, since I wouldn't have to
>assume anything about parameters.
>I am currently trying to see if there is anything in the client-side
>javascript generated for the report that will help me. I can see the current
>report parameters there, but I am still trying to figure out how to retrieve
>them properly...
>Anyway, all of this has helped me think through my design, so many thanks
>for your ideas.
>Malik
>"Si" <no@.spam.thanks> wrote in message
>news:l9nbi052eoggh9ucpro71t1t72lbnou72i@.4ax.com...
>> Hi Malik,
>> I've just completed an application which does exactly what you are
>> trying to do :) Mine does a little more like managing subscriptions,
>> schedules etc but the viewing and saving of the report/params is the
>> core of my app. I can't share the code as it's a commercial app but
>> will gladly help out with snippets etc :)
>> I did it the following way:
>> 1/ Reports are already on the server so I loop through the selected
>> report and obtain all the params for that report. I then
>> enable/disable webusercontrols for each of the params on screen.
>> see code below to get the params from a report (formatting screwed by
>> newsreader :( )
>> private void GetSpecificReportParameters(string report)
>> {
>> if(rs == null) rs = new ReportingService();
>> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
>> ReportParameter[] parameters parameters =>> rs.GetReportParameters(report, null, false, null, null);
>> if (parameters != null)
>> {
>> string []nameArray = new string[50];
>> int i = 0;
>> foreach (ReportParameter rp in parameters)
>> {
>> // this is each of the names banged into an array
>> nameArray[i] = rp.Name;
>> i++;
>> }
>> // now loop through em and switch on/off the correct params
>> foreach (string str in nameArray)
>> {
>> if(str == null) // nothing so carry on
>> continue;
>> if(str.ToString() == "SurnameFrom")
>> {
>> SurnameWebUserControl.Visible = true;
>> }
>> // etc etc for all params found
>> }
>> }
>> }
>>
>> 2/ now i've got all the params for the report and the relevant
>> controls to fill in these params, my user can now set their params and
>> click on either View or Save report.
>> View builds up a string from the webusercontrols, appending the &
>> after each param & then passing this into the ReportViewer control on
>> the form.
>> Save does the same building of the string but instead of rendering to
>> the ReportViewer control, it simply saves to a database field along
>> with the path to the report i.e. heres one I've just created:
>>
>/Reports/MyReport&rs:Command=Render&rs:Format=HTML4.0&rc:Parameters=false&Su
>rnameFrom=SMITH&SurnameTo=SMITH
>> When I recall the saved report, I simply pass that line in as the URL
>> prefixing the server address to it - then it's passed to the
>> ReportViewer control to render to screen.
>> Very simple and works very well - hope it makes sense to you. The
>> major advantage of this mechanism is that all we need to do is upload
>> a new report with params, the application will not need recompilation
>> in order to deal with the params (as long as no new params have been
>> added that the previous app knows nothing of!)
>> Si
>>
>>
>>
>> On Fri, 20 Aug 2004 10:30:45 +0100, "Abdul Malik Said"
>> <diplacusis@.hotmNOSPAMail.com> wrote:
>> >Mike,
>> >
>> >Thanks a lot for your help.
>> >
>> >I guess I was not clear in my stating of "Step 3", which was to determine
>> >which parameters the user last used to run the report. By this, I meant
>to
>> >say:
>> >
>> >How can I programmatically get from the report object model which
>parameters
>> >were last used to run the report? I have to get these first before I can
>> >store them in the database. Retrieving them and reconstituting them is
>not
>> >difficult after they are saved. The problem is, how do I find the values
>in
>> >the first place?
>> >
>> >Here is a better description:
>> >
>> >The user clicks "View Report" from the parameters toolbar
>> >The user clicks "Save Report" button which I have made elsewhere on the
>page
>> >
>> >In the code for the "Save Report" button, how do I reference the
>parameter
>> >values that were last chosen? I need to get these values from the report
>> >first, before I can store them in the database. This is what I don't know
>> >how to do.
>> >
>> >Any more help would be greatly appreciated.
>> >
>> >Malik
>> >
>|||Unfortunately, I have hit the wall with this one. The last hope was to use
the current URL that can be found in the client-side javascript generated
by the report server. However, I hear from microsoft that these variables
are for their internal use only, and could change in the future.
Since I don't want my reports to stop working when v2 is released, I can't
do that! :-@. I have given up hope for an "elegant solution".
I have looked at the SOAP method of integration as well as the URL method,
and it is just not possible to save report parameters as selected by the
user! The only way you can save them is if you re-invent your own parameter
inputs! And keep in mind that a complete integration solution should be able
to accept any possible combination of report parameters!
I think this is another oversight in the design of this product from
microsoft. They have specially designed ways to cache report data, saving
history, etc... But what about the more common case of wanting fresh data
for the same parameters? I am amazed that they did not think of this...
Malik
"Abdul Malik Said" <diplacusis@.hotmNOSPAMail.com> wrote in message
news:uMytSxqhEHA.3992@.TK2MSFTNGP11.phx.gbl...
> Hi Si,
> That is a good way to solve this problem. If I understand what you are
> doing, then it seems like you are basically writing your own code to
replace
> the parameter toolbar. This way, you know exactly what the values of the
> controls are when the user clicks "save".
> I could write a solution like this, but I was hoping there was a way of
> doing it without developing code to replace the parameter selection
toolbar.
> Since there is already a parameter toolbar, I would like to use it. This
> way, any report could be added to my application, since I wouldn't have to
> assume anything about parameters.
> I am currently trying to see if there is anything in the client-side
> javascript generated for the report that will help me. I can see the
current
> report parameters there, but I am still trying to figure out how to
retrieve
> them properly...
> Anyway, all of this has helped me think through my design, so many thanks
> for your ideas.
> Malik
> "Si" <no@.spam.thanks> wrote in message
> news:l9nbi052eoggh9ucpro71t1t72lbnou72i@.4ax.com...
> > Hi Malik,
> >
> > I've just completed an application which does exactly what you are
> > trying to do :) Mine does a little more like managing subscriptions,
> > schedules etc but the viewing and saving of the report/params is the
> > core of my app. I can't share the code as it's a commercial app but
> > will gladly help out with snippets etc :)
> >
> > I did it the following way:
> >
> > 1/ Reports are already on the server so I loop through the selected
> > report and obtain all the params for that report. I then
> > enable/disable webusercontrols for each of the params on screen.
> > see code below to get the params from a report (formatting screwed by
> > newsreader :( )
> >
> > private void GetSpecificReportParameters(string report)
> > {
> > if(rs == null) rs = new ReportingService();
> > rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> >
> > ReportParameter[] parameters parameters => > rs.GetReportParameters(report, null, false, null, null);
> >
> > if (parameters != null)
> > {
> > string []nameArray = new string[50];
> > int i = 0;
> > foreach (ReportParameter rp in parameters)
> > {
> > // this is each of the names banged into an array
> > nameArray[i] = rp.Name;
> > i++;
> > }
> >
> > // now loop through em and switch on/off the correct params
> > foreach (string str in nameArray)
> > {
> > if(str == null) // nothing so carry on
> > continue;
> >
> > if(str.ToString() == "SurnameFrom")
> > {
> > SurnameWebUserControl.Visible = true;
> > }
> > // etc etc for all params found
> > }
> > }
> > }
> >
> >
> > 2/ now i've got all the params for the report and the relevant
> > controls to fill in these params, my user can now set their params and
> > click on either View or Save report.
> >
> > View builds up a string from the webusercontrols, appending the &
> > after each param & then passing this into the ReportViewer control on
> > the form.
> >
> > Save does the same building of the string but instead of rendering to
> > the ReportViewer control, it simply saves to a database field along
> > with the path to the report i.e. heres one I've just created:
> >
> >
>
/Reports/MyReport&rs:Command=Render&rs:Format=HTML4.0&rc:Parameters=false&Su
> rnameFrom=SMITH&SurnameTo=SMITH
> >
> > When I recall the saved report, I simply pass that line in as the URL
> > prefixing the server address to it - then it's passed to the
> > ReportViewer control to render to screen.
> >
> > Very simple and works very well - hope it makes sense to you. The
> > major advantage of this mechanism is that all we need to do is upload
> > a new report with params, the application will not need recompilation
> > in order to deal with the params (as long as no new params have been
> > added that the previous app knows nothing of!)
> >
> > Si
> >
> >
> >
> >
> >
> >
> >
> > On Fri, 20 Aug 2004 10:30:45 +0100, "Abdul Malik Said"
> > <diplacusis@.hotmNOSPAMail.com> wrote:
> >
> > >Mike,
> > >
> > >Thanks a lot for your help.
> > >
> > >I guess I was not clear in my stating of "Step 3", which was to
determine
> > >which parameters the user last used to run the report. By this, I meant
> to
> > >say:
> > >
> > >How can I programmatically get from the report object model which
> parameters
> > >were last used to run the report? I have to get these first before I
can
> > >store them in the database. Retrieving them and reconstituting them is
> not
> > >difficult after they are saved. The problem is, how do I find the
values
> in
> > >the first place?
> > >
> > >Here is a better description:
> > >
> > >The user clicks "View Report" from the parameters toolbar
> > >The user clicks "Save Report" button which I have made elsewhere on the
> page
> > >
> > >In the code for the "Save Report" button, how do I reference the
> parameter
> > >values that were last chosen? I need to get these values from the
report
> > >first, before I can store them in the database. This is what I don't
know
> > >how to do.
> > >
> > >Any more help would be greatly appreciated.
> > >
> > >Malik
> > >
>sql

how to save query to file in Query Designer

Using SQL Server 2000's Query Designer (not analyzer), I can create a
query, look at the query in SQL pane. On a right click, if I select
save as, there is no file dialog to inquire where to save file. If I
select save, I can't find file.
Is the save-as a bug?
Where should I look for the file; what naming convention is used?
RitaRita,
You are correct that Save As and Save do not work here. See
http://groups.google.com/groups?q=hoegemeier%2Bsigouin
for an answer to this question.
SK
"Rita W." <riwillia@.telus.net> wrote in message
news:40130D48.2050708@.telus.net...
quote:

> Using SQL Server 2000's Query Designer (not analyzer), I can create a
> query, look at the query in SQL pane. On a right click, if I select
> save as, there is no file dialog to inquire where to save file. If I
> select save, I can't find file.
> Is the save-as a bug?
> Where should I look for the file; what naming convention is used?
> Rita
>
|||Thanks, Steve.
R
Steve Kass wrote:
quote:

>Rita,
> You are correct that Save As and Save do not work here. See
>http://groups.google.com/groups?q=hoegemeier%2Bsigouin
>for an answer to this question.
>SK
>"Rita W." <riwillia@.telus.net> wrote in message
>news:40130D48.2050708@.telus.net...
>
>
>

how to save query to file in Query Designer

Using SQL Server 2000's Query Designer (not analyzer), I can create a
query, look at the query in SQL pane. On a right click, if I select
save as, there is no file dialog to inquire where to save file. If I
select save, I can't find file.
Is the save-as a bug?
Where should I look for the file; what naming convention is used?
RitaRita,
You are correct that Save As and Save do not work here. See
http://groups.google.com/groups?q=hoegemeier%2Bsigouin
for an answer to this question.
SK
"Rita W." <riwillia@.telus.net> wrote in message
news:40130D48.2050708@.telus.net...
> Using SQL Server 2000's Query Designer (not analyzer), I can create a
> query, look at the query in SQL pane. On a right click, if I select
> save as, there is no file dialog to inquire where to save file. If I
> select save, I can't find file.
> Is the save-as a bug?
> Where should I look for the file; what naming convention is used?
> Rita
>|||Thanks, Steve.
R
Steve Kass wrote:
>Rita,
> You are correct that Save As and Save do not work here. See
>http://groups.google.com/groups?q=hoegemeier%2Bsigouin
>for an answer to this question.
>SK
>"Rita W." <riwillia@.telus.net> wrote in message
>news:40130D48.2050708@.telus.net...
>
>>Using SQL Server 2000's Query Designer (not analyzer), I can create a
>>query, look at the query in SQL pane. On a right click, if I select
>>save as, there is no file dialog to inquire where to save file. If I
>>select save, I can't find file.
>>Is the save-as a bug?
>>Where should I look for the file; what naming convention is used?
>>Rita
>>
>
>

how to save query in Query Designer

Just learning SQL Server, using MS Step by Step book. I think I should be able to right click in query designer pane and save-as query. I see this option in context menu. When I try to save file, I don't get file dialog to specify file name. I also don't get error. Any ideas?

Thanks.Are you using Query Analyzer?|||Originally posted by blindman
Are you using Query Analyzer?

Sorry, I should have been more precise. Using SQL Server2000 (on Windows2000 Server) Enterprise Manager to create query in its Query Designer.

How to save query execution plan?

Hello,
Does anyone know how to save a query plan into word doc?
Thanks,
Lianne> Does anyone know how to save a query plan into word doc?
There are a variety of ways.
You can click that pane of QA, print it...to file and save as text (which
works for the textual query plan, or you could Alt+PrntScrn it like I do,
and then crop off the query plan part of the screen shot, save it as a jpg
and then insert that to your word doc.
I bet other people will suggest other things. I like the JPG -> Word
option, because it lets you keep an original of your Q-Plan.
Unfortunately, my way does not capture the information that QA puts in the
tooltips when you wave your mouse over the steps.
--
Peace & happy computing,
Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei
"Lianne Kwock" <LianneKwock@.discussions.microsoft.com> wrote in message
news:658E97FA-289D-40A7-B998-7F944CD7D472@.microsoft.com...
> Hello,
>
> Thanks,
> Lianne|||Hi Mike,
Thank very much for your suggestion. I appreicate it.
"Mike Labosh" wrote:

> There are a variety of ways.
> You can click that pane of QA, print it...to file and save as text (which
> works for the textual query plan, or you could Alt+PrntScrn it like I do,
> and then crop off the query plan part of the screen shot, save it as a jpg
> and then insert that to your word doc.
> I bet other people will suggest other things. I like the JPG -> Word
> option, because it lets you keep an original of your Q-Plan.
> Unfortunately, my way does not capture the information that QA puts in the
> tooltips when you wave your mouse over the steps.
> --
>
> Peace & happy computing,
> Mike Labosh, MCSD MCT
> Owner, vbSensei.Com
> "Escriba coda ergo sum." -- vbSensei
>
> "Lianne Kwock" <LianneKwock@.discussions.microsoft.com> wrote in message
> news:658E97FA-289D-40A7-B998-7F944CD7D472@.microsoft.com...
>
>|||Lianne Kwock wrote:
> Hi Mike,
> Thank very much for your suggestion. I appreicate it.
> "Mike Labosh" wrote:
>
If you are using SQL Server SQL Server 2005 you can use
set showplan_xml on
which will show exeution plan in XML
which you can use to force query execution plan using USE PLAN query
hint.
You can also create plan guide for query which will guide query for
execution when no plan in cache.
Look at sp_create_plan_guide in BOL.
Regards
Amish Shah

How to save performance counters values to SQL Server database tab

I am monitoring sql server and windows performance counters.
My computer has "Microsoft windows XP professional". I am monitoring sql
servers (2000 (sp3 and sp4) and 2005) running on windows NT 4 and 5.2.
For historical analysis I want to store the values of various counters in
sql server database(table). I have created a a DSN for the sql server 2005
installed on my PC for data repository. Still I can save counter values as
report(.tsv) ot web (.html). I want to save the values to SQL server TABLE.
hOW DO i DO THAT'
--
ontario, canadaI am using microsoft management console 2.0 version 5.1.
--
ontario, canada
"db" wrote:
> I am monitoring sql server and windows performance counters.
> My computer has "Microsoft windows XP professional". I am monitoring sql
> servers (2000 (sp3 and sp4) and 2005) running on windows NT 4 and 5.2.
> For historical analysis I want to store the values of various counters in
> sql server database(table). I have created a a DSN for the sql server 2005
> installed on my PC for data repository. Still I can save counter values as
> report(.tsv) ot web (.html). I want to save the values to SQL server TABLE.
> hOW DO i DO THAT'
> --
> ontario, canada|||db
How about?
SELECT * FROM sys.dm_os_performance_counters
WHERE counter_name = 'Total Server Memory (KB)'
OR counter_name = 'Target Server Memory (KB)';
SELECT * FROM sys.dm_os_performance_counters
WHERE counter_name = 'Page life expectancy'
AND object_name = 'SQLServer:Buffer Manager';
"db" <db@.discussions.microsoft.com> wrote in message
news:F027E65B-CADE-41AE-97E2-DD3079D42481@.microsoft.com...
> I am monitoring sql server and windows performance counters.
> My computer has "Microsoft windows XP professional". I am monitoring sql
> servers (2000 (sp3 and sp4) and 2005) running on windows NT 4 and 5.2.
> For historical analysis I want to store the values of various counters in
> sql server database(table). I have created a a DSN for the sql server 2005
> installed on my PC for data repository. Still I can save counter values as
> report(.tsv) ot web (.html). I want to save the values to SQL server
> TABLE.
> hOW DO i DO THAT'
> --
> ontario, canada|||Thanks Uri. Two questions:
1. It works for SQL server 2005 by in sql server 2000 I am getting this
error message:
Msg 208, Level 16, State 1, Line 1
Invalid object name 'sys.dm_os_performance_counters'.
2. Parameter like sql Server: Buffer Manager (Buffer cache hit ratio) has a
value 3310 by this select statement. I was expecting something like (99%).
3. Many counters that available through MMC are not present in this table.
Should I be looking at some other tables.
--
ontario, canada
"Uri Dimant" wrote:
> db
> How about?
> SELECT * FROM sys.dm_os_performance_counters
> WHERE counter_name = 'Total Server Memory (KB)'
> OR counter_name = 'Target Server Memory (KB)';
> SELECT * FROM sys.dm_os_performance_counters
> WHERE counter_name = 'Page life expectancy'
> AND object_name = 'SQLServer:Buffer Manager';
>
> "db" <db@.discussions.microsoft.com> wrote in message
> news:F027E65B-CADE-41AE-97E2-DD3079D42481@.microsoft.com...
> >
> > I am monitoring sql server and windows performance counters.
> >
> > My computer has "Microsoft windows XP professional". I am monitoring sql
> > servers (2000 (sp3 and sp4) and 2005) running on windows NT 4 and 5.2.
> >
> > For historical analysis I want to store the values of various counters in
> > sql server database(table). I have created a a DSN for the sql server 2005
> > installed on my PC for data repository. Still I can save counter values as
> > report(.tsv) ot web (.html). I want to save the values to SQL server
> > TABLE.
> > hOW DO i DO THAT'
> >
> > --
> > ontario, canada
>
>|||1. Table in sql server 2000 looks like "sysperfinfo".
4. I need to append everyday all the counter values to the table with a
field for datetime at which counter values were captured.
ontario, canada
"db" wrote:
> Thanks Uri. Two questions:
> 1. It works for SQL server 2005 by in sql server 2000 I am getting this
> error message:
> Msg 208, Level 16, State 1, Line 1
> Invalid object name 'sys.dm_os_performance_counters'.
> 2. Parameter like sql Server: Buffer Manager (Buffer cache hit ratio) has a
> value 3310 by this select statement. I was expecting something like (99%).
> 3. Many counters that available through MMC are not present in this table.
> Should I be looking at some other tables.
> --
> ontario, canada
>
> "Uri Dimant" wrote:
> > db
> > How about?
> > SELECT * FROM sys.dm_os_performance_counters
> >
> > WHERE counter_name = 'Total Server Memory (KB)'
> >
> > OR counter_name = 'Target Server Memory (KB)';
> >
> > SELECT * FROM sys.dm_os_performance_counters
> >
> > WHERE counter_name = 'Page life expectancy'
> >
> > AND object_name = 'SQLServer:Buffer Manager';
> >
> >
> > "db" <db@.discussions.microsoft.com> wrote in message
> > news:F027E65B-CADE-41AE-97E2-DD3079D42481@.microsoft.com...
> > >
> > > I am monitoring sql server and windows performance counters.
> > >
> > > My computer has "Microsoft windows XP professional". I am monitoring sql
> > > servers (2000 (sp3 and sp4) and 2005) running on windows NT 4 and 5.2.
> > >
> > > For historical analysis I want to store the values of various counters in
> > > sql server database(table). I have created a a DSN for the sql server 2005
> > > installed on my PC for data repository. Still I can save counter values as
> > > report(.tsv) ot web (.html). I want to save the values to SQL server
> > > TABLE.
> > > hOW DO i DO THAT'
> > >
> > > --
> > > ontario, canada
> >
> >
> >|||I was able to save it in sql server table through MMC perfmon in the way i
want to do it.
--
ontario, canada
"db" wrote:
> 1. Table in sql server 2000 looks like "sysperfinfo".
> 4. I need to append everyday all the counter values to the table with a
> field for datetime at which counter values were captured.
> ontario, canada
>
> "db" wrote:
> > Thanks Uri. Two questions:
> >
> > 1. It works for SQL server 2005 by in sql server 2000 I am getting this
> > error message:
> >
> > Msg 208, Level 16, State 1, Line 1
> > Invalid object name 'sys.dm_os_performance_counters'.
> >
> > 2. Parameter like sql Server: Buffer Manager (Buffer cache hit ratio) has a
> > value 3310 by this select statement. I was expecting something like (99%).
> >
> > 3. Many counters that available through MMC are not present in this table.
> > Should I be looking at some other tables.
> >
> > --
> > ontario, canada
> >
> >
> > "Uri Dimant" wrote:
> >
> > > db
> > > How about?
> > > SELECT * FROM sys.dm_os_performance_counters
> > >
> > > WHERE counter_name = 'Total Server Memory (KB)'
> > >
> > > OR counter_name = 'Target Server Memory (KB)';
> > >
> > > SELECT * FROM sys.dm_os_performance_counters
> > >
> > > WHERE counter_name = 'Page life expectancy'
> > >
> > > AND object_name = 'SQLServer:Buffer Manager';
> > >
> > >
> > > "db" <db@.discussions.microsoft.com> wrote in message
> > > news:F027E65B-CADE-41AE-97E2-DD3079D42481@.microsoft.com...
> > > >
> > > > I am monitoring sql server and windows performance counters.
> > > >
> > > > My computer has "Microsoft windows XP professional". I am monitoring sql
> > > > servers (2000 (sp3 and sp4) and 2005) running on windows NT 4 and 5.2.
> > > >
> > > > For historical analysis I want to store the values of various counters in
> > > > sql server database(table). I have created a a DSN for the sql server 2005
> > > > installed on my PC for data repository. Still I can save counter values as
> > > > report(.tsv) ot web (.html). I want to save the values to SQL server
> > > > TABLE.
> > > > hOW DO i DO THAT'
> > > >
> > > > --
> > > > ontario, canada
> > >
> > >
> > >sql

How to save PDF files to SQL Server?

Hellow, everyone:

I have PDF files on local hard drive, and want to save them to the table in SQL Server. Can I execute by SQL Server? If yes, how to do that.

Someone said to create a table with IMAGE column, and write PDF files to this table. How about details for this way?

Thanks a lot.

ZYTWhile you can store files inside of SQL Server, I recommend against it. Files are a "complex data type", so you can't sort, index, compare, or do any other practical operations with them. You can however store a UNC name for a file in a database, and there are many parctical things you can do with that.

There are some reasons for considering storing files inside of SQL Server, but they are few and far between and all of the reasons that I know about are kludges to address application design flaws. If you can avoid the headaches associated with storing files inside your database, I'd recommend avoiding it!

-PatP|||Hi, Pat:

Thanks for reply.

I have to save PDF files to SQL Server, and then retreive/dispaly them. Because security issue, the PDF files are not allowed put in web server, so frontend code cannot read them. PDF files are in database server.

Can you offer codes that can write/read PDF to/from SQL Server? Thanks a lot.

ZYT

How to save pdf files to SQL database?

Hi all,

Can someone please brief me on how to save 'pdf' files(there are about 15 files) into a SQL database and retrieve/open it from a datagrid?

I have about 15 pdf files on my webserver and need to save it in the SQL database, so every pdf file saved in the database will have a primary key and the file will be saved either as 'ntext' or 'binary' type...I just have this rough idea.

If someone has a ready code in VB.net then nothing better( i know thats a shortcut :) but it will help me like a tutorial. C# code will do too, I can then convert the code to Vb.net

Thanks a ton.

OFF:

Do you really need to save 'pdf' files into a database? Wouldn't it be better to save 'pdf' files in the filesystem and save their path in the database? I think the performance in this case would be better.|||Hi there,
Firstly thanks a lot for the reply. actually thats what my manager wants me to do...but I agree with you about the file system and saving it's path, I am sure it will also reduce the complexity of code behind.I already have the pdf files on the web server so probably saving the path will work well...in any case if you have a ready solution for doing this or if you can help me with how to go about it, I can handle it further on.
thankyou once again, your help is appreciated.

how to save or retrieve a picture from a table in sql server 2000

hi ,
am wondering how to save or retrieve an image in sql server 2000 table
using vb application or access thx
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!Hi
http://support.microsoft.com/defaul...kb;en-us;153238
http://support.microsoft.com/defaul...kb;en-us;194975
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/
"Joe Saliba" <josephs73@.hotmail.com> wrote in message
news:OWE7fj3HFHA.3472@.TK2MSFTNGP09.phx.gbl...
> hi ,
> am wondering how to save or retrieve an image in sql server 2000 table
> using vb application or access thx
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!|||You just "select " the colname from the table the same way you would any
other column data. On the client side, you need t otreat the output as a
byte array, and "eed" it to whatever it is being used in ... The techniques
for that part are dependant on what and how it is being used, and the
technology you are doing it in (VB6, VB/C#.Net, ASP, HTML, etc. etc. )
"Joe Saliba" wrote:

> hi ,
> am wondering how to save or retrieve an image in sql server 2000 table
> using vb application or access thx
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
>

How to Save MS Word/Excel Files in Database?

Dear all, i have a problem.

i have to save a word doc or an excel file in the database in the module given to me where .net is the platform that i am using, can some one help me out in this.
thanks in advance

Regards
PuligaHi Puliga,

Have you found the answer yet?
I like to do the same over here.

regards
Pleun|||I would suggest storing full path to those files only and not files them selves.
Even if you will manage storing data in a database, you will encounter slowness in retrieving those documents and will convert to my first idea anyway... :)