Stored Procedure Text history - sql-server-2008

I am not that much well versed in SQL Server. I am using SQL Server 2008 R2. I wanted to know if we can get the history of the text of the stored procedures?
I had modified a procedure on the server and now I want to get the previous text of that stored procedure? I know we can get the last modified date or history of the procedure when it was modified. Is there anyway to get the previous text of the procedure?
Any help is highly appreciated.

Unfortunately you cant recover it once you update your stored procedure. One thing to avoid this in the future is save your query before modifying it. SQL SERVER doesnt have a History Feature like JAVA.There are also third party tools which you can use if you want to connect your database to a source control.
Click Here

Related

Run stored procedure stored on one server on another

We try to run all our reports off stored procedures, however, now I am trying to report off a 3rd party server that I cannot deploy too. I am trying to find away to store the stored procedure on Server1, but execute on Server2 but the only link is the RDL which can see both data sets. I do not think this is possible.

Getting VS2013/SSRS to permanently use a .SQL file instead of manually pasting/importing queries for a dataset

First time posting here, want to start by saying thanks to the community here for the amazing insights I've enjoyed over the years
I build reports with SSRS in VS2013 and currently have to paste/import MySQL statements every time I create/update the datasets. I want VS2013/SSRS to permanently refer to a local .SQL file instead of having me manually paste the query text every time I need to update it. How does I do this?
In my ideal world, I would have a folder bank full of SQL query files that VS would use to acquire data from the DB for the reports. Then all I would have to do is alter the separate, local SQL files and VS would take it from there.
I see 3 vectors for supplying the SQL query to the dataset: 1) Paste/Import the text query, 2) Table access, 3)Stored procedures. I thought there might be a way thru Stored Procedures but I'm not having any luck discovering if it's possible and how to code it from documentation and the web.
If it's useful, Visual Studio 2013 is platformed on a Windows server O/S.
Create your script as a stored procedure on the server you're querying. Configure all your reports based on that dataset to run that stored procedure. When you update the stored procedure, all reports that use that SP are affected by the code change.

Se SQL statetement beeing run within a procedure with SQL Server Profiler

This is not directly a programming question but I ask it anyway because it's related to debugging.
I wonder if it's possible to see exactly what SQL statements that are being executed within a procedure in Microsoft SQL Server Profiler?
For now I just see the procedures being called but due to complicated procedures causing a tricky bug somewhere I would like to see exactly what SQL statement being executed. So it would be nice if anyone has any tip on this.
Yes this is possible.
Add SP:StmtStarting and/or SP:StmtCompleted to the events you are tracing.

Find out filed update procedure

currently I am working inside a company with a really messy information system. I mean: the system administrator does not have a full understanding of all the procedures and processes that daily run on the net they are working on!
We have this kind of problem: every day at 5 am, a filed in a table on one database (SQl Server 2008) is updated without any sense.
My question is: if we exclude the SQL profiler, there are other way to discover major details on the procedure, process, user or application that update the field?
You can try these tools.
Profiler for Microsoft SQL Server 2005/2008
http://www.codeproject.com/KB/database/TSQL-profiler.aspx

How to create textbox in Microsoft Reporting Service?

I have create a report in Microsoft Reporting Service that is presented in a browser. I would like to create button that opens a textbox where the user can fill in text. This text should be saved in column in the underlying database.
That cannot be done, Reporting Services is not for that.
But...... if you really really want to do it, it can be done this way:
create a report
in the parameters section have a textbox input like you mention above
define a dataset that calls a stored procedure*, that stored procedure should take the contents of that textbox as a parameter
in the stored procedure you can insert that value into a table
*note that it doesn't have to be a stored proc, that just makes it easier. You could just do it straight in the command text of the dataset.
This tip was only for the brave and the demented. Now refer back to the bit where i said "Reporting Services is not for that". This is a very bad practice, probably worse than using a goto statement, use it carefully.