Showing posts with label altering. Show all posts
Showing posts with label altering. Show all posts

Wednesday, March 7, 2012

Programmatically altering object code

Has anyone developed a way to programmatically alter the code for multiple
stored procs, functions, etc.?
For example: suppose your database contains hundreds of stored procedures
which access a certain table. Along comes a requirement to rename this
table. It's a lot of tedious work to have to individually open each proc in
QA/EM and change the code. I would like to be able to simply type something
like:
EXEC sp_alter_proc_code 'OldTable', 'NewTable'
And presto, all procs that contain SQL statements that query OldTable are
now pointing to NewTable!
Note that you cannot run an UPDATE statement against syscomment's text field
(e.g., UPDATE syscomments SET text = REPLACE(text, 'OldTable', 'NewTable')),
since this is a computed field.
One solution that I had experimented with was to capture the contents of
syscomment's text column into a variable, run REPLACE against that variable,
and EXEC it. But the problem with that is, a variable can hold only 8000
characters.
I would be interested to hear if anyone has developed a workable solution
for this.>It's a lot of tedious work to have to individually open each proc in
>QA/EM and change the code.
Script all the procs out into a single file as CREATEs (without the
delete!) Open the script in Query Analyzer. Change all the CREATE
PROCs to ALTER PROC. Change all occurances of the old table name to
the new table name - there is a REPLACE ALL feature.
Execute the script.
Roy Harvey
Beacon Falls, CT|||CadeBryant wrote:
> Has anyone developed a way to programmatically alter the code for
> multiple stored procs, functions, etc.?
> For example: suppose your database contains hundreds of stored
> procedures which access a certain table. Along comes a requirement
> to rename this table. It's a lot of tedious work to have to
> individually open each proc in QA/EM and change the code. I would
> like to be able to simply type something like:
> EXEC sp_alter_proc_code 'OldTable', 'NewTable'
> And presto, all procs that contain SQL statements that query OldTable
> are now pointing to NewTable!
> Note that you cannot run an UPDATE statement against syscomment's
> text field (e.g., UPDATE syscomments SET text = REPLACE(text,
> 'OldTable', 'NewTable')), since this is a computed field.
> One solution that I had experimented with was to capture the contents
> of syscomment's text column into a variable, run REPLACE against that
> variable, and EXEC it. But the problem with that is, a variable can
> hold only 8000 characters.
> I would be interested to hear if anyone has developed a workable
> solution for this.
If you are managing your stored procedures using version control
software outside of SQL Server, then you can simply perform a find and
replace. You really should not be managing your procedures using SQL
Server. If you are, I would recommend you extract all procedures and get
them in some form of version control software before beginning this
process.
David Gugick - SQL Server MVP
Quest Software

Programmatically Alter a Report on Report Server

Hi,
I am looking at altering a report on report server programmatically from a
web page.
Is this possible, has someone done this?
Thanks
PonnuIf your ASP/Perl program can handle RDL file with XML format. Technically,
You can do it.
Ponnu wrote:
>Hi,
>I am looking at altering a report on report server programmatically from a
>web page.
>Is this possible, has someone done this?
>Thanks
>Ponnu
--
I am a frog enjoying the sunshine on waikiki beach. Do you want to join me?!
Message posted via http://www.sqlmonster.com|||Hi WaikikiFrog,
I am using ASP.Net,
how could I read a report present in Report Server?
and once read, I could modify it, then how to put it back onto the Report
Server?
I would greatly appreciate your suggestions\guidance on this
Thanks
Ponnu
"WaikikiFrog via SQLMonster.com" <u19654@.uwe> wrote in message
news:6c79610a3e0cd@.uwe...
> If your ASP/Perl program can handle RDL file with XML format. Technically,
> You can do it.
>
> Ponnu wrote:
>>Hi,
>>I am looking at altering a report on report server programmatically from a
>>web page.
>>Is this possible, has someone done this?
>>Thanks
>>Ponnu
> --
> I am a frog enjoying the sunshine on waikiki beach. Do you want to join
> me?!
> Message posted via http://www.sqlmonster.com
>|||This is a very bad idea. Although technically possible you cannot do what
you want with the server based product for all practical purposes. The RDL
is shared by everyone running the report. If you read the report in (which
should be possible using the web services api) you then deploy it. That rdl
is used for everyone. Understanding and modifying the rdl is non-trivial
(the specificiation can be found here:
http://www.microsoft.com/sql/technologies/reporting/rdlspec.mspx)
You will have performance problems and (as I noted above) anyone else
running the report will get the new report.
But, if you absolutely have to, instead you should get the new reportviewer
controls that ship with VS 2005. There is an asp.net 2.0 control and a
winform control. You can use this in local mode. In local mode no server is
used. You give the control the report and the data and it renders it. Again,
it is non-trivial if you have any sort of complex report.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Ponnu" <someone@.somewhere.com> wrote in message
news:ugJhRPzOHHA.324@.TK2MSFTNGP06.phx.gbl...
> Hi WaikikiFrog,
> I am using ASP.Net,
> how could I read a report present in Report Server?
> and once read, I could modify it, then how to put it back onto the Report
> Server?
> I would greatly appreciate your suggestions\guidance on this
> Thanks
> Ponnu
> "WaikikiFrog via SQLMonster.com" <u19654@.uwe> wrote in message
> news:6c79610a3e0cd@.uwe...
>> If your ASP/Perl program can handle RDL file with XML format.
>> Technically,
>> You can do it.
>>
>> Ponnu wrote:
>>Hi,
>>I am looking at altering a report on report server programmatically from
>>a
>>web page.
>>Is this possible, has someone done this?
>>Thanks
>>Ponnu
>> --
>> I am a frog enjoying the sunshine on waikiki beach. Do you want to join
>> me?!
>> Message posted via http://www.sqlmonster.com
>|||Hi Bruce,
Thanks for the suggestion.
This is what I am trying to do, you might be able to help me out
I already have some reports designed using Report Designer(SSRS 2005) and
deployed to report server. I need to provide options for the end users to
change the order of columns in the report using a ASP.Net web page. So I
thought I will use a report viewer control to preivew the report in web page
and a grid(showing the list of columns) using which you could change the
order of columns. I then should be able to make this change in the report in
the report server.
I can't use Report Builder because Report Builder will not open\render the
reports designed in Report Designer even though the reverse is possible. For
more details please refer to this link
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=595894&SiteID=1
So all I need is to be able to read a report from report server and make the
changes in the order of columns and deploy it back to report server.
I would greatly appreciate your help in this.
Thanks
Ponnu
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:OCE6mTzOHHA.4372@.TK2MSFTNGP04.phx.gbl...
> This is a very bad idea. Although technically possible you cannot do what
> you want with the server based product for all practical purposes. The RDL
> is shared by everyone running the report. If you read the report in (which
> should be possible using the web services api) you then deploy it. That
> rdl is used for everyone. Understanding and modifying the rdl is
> non-trivial (the specificiation can be found here:
> http://www.microsoft.com/sql/technologies/reporting/rdlspec.mspx)
> You will have performance problems and (as I noted above) anyone else
> running the report will get the new report.
> But, if you absolutely have to, instead you should get the new
> reportviewer controls that ship with VS 2005. There is an asp.net 2.0
> control and a winform control. You can use this in local mode. In local
> mode no server is used. You give the control the report and the data and
> it renders it. Again, it is non-trivial if you have any sort of complex
> report.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Ponnu" <someone@.somewhere.com> wrote in message
> news:ugJhRPzOHHA.324@.TK2MSFTNGP06.phx.gbl...
>> Hi WaikikiFrog,
>> I am using ASP.Net,
>> how could I read a report present in Report Server?
>> and once read, I could modify it, then how to put it back onto the Report
>> Server?
>> I would greatly appreciate your suggestions\guidance on this
>> Thanks
>> Ponnu
>> "WaikikiFrog via SQLMonster.com" <u19654@.uwe> wrote in message
>> news:6c79610a3e0cd@.uwe...
>> If your ASP/Perl program can handle RDL file with XML format.
>> Technically,
>> You can do it.
>>
>> Ponnu wrote:
>>Hi,
>>I am looking at altering a report on report server programmatically from
>>a
>>web page.
>>Is this possible, has someone done this?
>>Thanks
>>Ponnu
>> --
>> I am a frog enjoying the sunshine on waikiki beach. Do you want to join
>> me?!
>> Message posted via http://www.sqlmonster.com
>>
>|||Read up on web services. Report Manager itself uses web services with Report
Server.
The effort to do this is large. You would be better off to have the users
export it to Excel if they want a different order of the columns.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Ponnu" <someone@.somewhere.com> wrote in message
news:udQrnX0OHHA.3872@.TK2MSFTNGP06.phx.gbl...
> Hi Bruce,
> Thanks for the suggestion.
> This is what I am trying to do, you might be able to help me out
> I already have some reports designed using Report Designer(SSRS 2005) and
> deployed to report server. I need to provide options for the end users to
> change the order of columns in the report using a ASP.Net web page. So I
> thought I will use a report viewer control to preivew the report in web
> page and a grid(showing the list of columns) using which you could change
> the order of columns. I then should be able to make this change in the
> report in the report server.
> I can't use Report Builder because Report Builder will not open\render the
> reports designed in Report Designer even though the reverse is possible.
> For more details please refer to this link
> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=595894&SiteID=1
> So all I need is to be able to read a report from report server and make
> the changes in the order of columns and deploy it back to report server.
> I would greatly appreciate your help in this.
> Thanks
> Ponnu
> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
> news:OCE6mTzOHHA.4372@.TK2MSFTNGP04.phx.gbl...
>> This is a very bad idea. Although technically possible you cannot do what
>> you want with the server based product for all practical purposes. The
>> RDL is shared by everyone running the report. If you read the report in
>> (which should be possible using the web services api) you then deploy it.
>> That rdl is used for everyone. Understanding and modifying the rdl is
>> non-trivial (the specificiation can be found here:
>> http://www.microsoft.com/sql/technologies/reporting/rdlspec.mspx)
>> You will have performance problems and (as I noted above) anyone else
>> running the report will get the new report.
>> But, if you absolutely have to, instead you should get the new
>> reportviewer controls that ship with VS 2005. There is an asp.net 2.0
>> control and a winform control. You can use this in local mode. In local
>> mode no server is used. You give the control the report and the data and
>> it renders it. Again, it is non-trivial if you have any sort of complex
>> report.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Ponnu" <someone@.somewhere.com> wrote in message
>> news:ugJhRPzOHHA.324@.TK2MSFTNGP06.phx.gbl...
>> Hi WaikikiFrog,
>> I am using ASP.Net,
>> how could I read a report present in Report Server?
>> and once read, I could modify it, then how to put it back onto the
>> Report Server?
>> I would greatly appreciate your suggestions\guidance on this
>> Thanks
>> Ponnu
>> "WaikikiFrog via SQLMonster.com" <u19654@.uwe> wrote in message
>> news:6c79610a3e0cd@.uwe...
>> If your ASP/Perl program can handle RDL file with XML format.
>> Technically,
>> You can do it.
>>
>> Ponnu wrote:
>>Hi,
>>I am looking at altering a report on report server programmatically
>>from a
>>web page.
>>Is this possible, has someone done this?
>>Thanks
>>Ponnu
>> --
>> I am a frog enjoying the sunshine on waikiki beach. Do you want to join
>> me?!
>> Message posted via http://www.sqlmonster.com
>>
>>
>|||Hi Bruce,
Can't go for excel option because, in our application the users in admin
role will make the changes so that the others users could download in
whatever format they want(preferably PDF)
If there is any link\resource relating to reading a report from Report
Server using a webservice and deploying it back again, please let me know.
In the meanwhile I will investigate how this Report Manager actually
downloads and uploads reports to Report Server.
Thanks
Ponnu
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:O55xfC2OHHA.4244@.TK2MSFTNGP04.phx.gbl...
> Read up on web services. Report Manager itself uses web services with
> Report Server.
> The effort to do this is large. You would be better off to have the users
> export it to Excel if they want a different order of the columns.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Ponnu" <someone@.somewhere.com> wrote in message
> news:udQrnX0OHHA.3872@.TK2MSFTNGP06.phx.gbl...
>> Hi Bruce,
>> Thanks for the suggestion.
>> This is what I am trying to do, you might be able to help me out
>> I already have some reports designed using Report Designer(SSRS 2005) and
>> deployed to report server. I need to provide options for the end users to
>> change the order of columns in the report using a ASP.Net web page. So I
>> thought I will use a report viewer control to preivew the report in web
>> page and a grid(showing the list of columns) using which you could change
>> the order of columns. I then should be able to make this change in the
>> report in the report server.
>> I can't use Report Builder because Report Builder will not open\render
>> the reports designed in Report Designer even though the reverse is
>> possible. For more details please refer to this link
>> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=595894&SiteID=1
>> So all I need is to be able to read a report from report server and make
>> the changes in the order of columns and deploy it back to report server.
>> I would greatly appreciate your help in this.
>> Thanks
>> Ponnu
>> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
>> news:OCE6mTzOHHA.4372@.TK2MSFTNGP04.phx.gbl...
>> This is a very bad idea. Although technically possible you cannot do
>> what you want with the server based product for all practical purposes.
>> The RDL is shared by everyone running the report. If you read the report
>> in (which should be possible using the web services api) you then deploy
>> it. That rdl is used for everyone. Understanding and modifying the rdl
>> is non-trivial (the specificiation can be found here:
>> http://www.microsoft.com/sql/technologies/reporting/rdlspec.mspx)
>> You will have performance problems and (as I noted above) anyone else
>> running the report will get the new report.
>> But, if you absolutely have to, instead you should get the new
>> reportviewer controls that ship with VS 2005. There is an asp.net 2.0
>> control and a winform control. You can use this in local mode. In local
>> mode no server is used. You give the control the report and the data and
>> it renders it. Again, it is non-trivial if you have any sort of complex
>> report.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Ponnu" <someone@.somewhere.com> wrote in message
>> news:ugJhRPzOHHA.324@.TK2MSFTNGP06.phx.gbl...
>> Hi WaikikiFrog,
>> I am using ASP.Net,
>> how could I read a report present in Report Server?
>> and once read, I could modify it, then how to put it back onto the
>> Report Server?
>> I would greatly appreciate your suggestions\guidance on this
>> Thanks
>> Ponnu
>> "WaikikiFrog via SQLMonster.com" <u19654@.uwe> wrote in message
>> news:6c79610a3e0cd@.uwe...
>> If your ASP/Perl program can handle RDL file with XML format.
>> Technically,
>> You can do it.
>>
>> Ponnu wrote:
>>Hi,
>>I am looking at altering a report on report server programmatically
>>from a
>>web page.
>>Is this possible, has someone done this?
>>Thanks
>>Ponnu
>> --
>> I am a frog enjoying the sunshine on waikiki beach. Do you want to
>> join me?!
>> Message posted via http://www.sqlmonster.com
>>
>>
>>
>