.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Restoring sql server database with stored procedures

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :ASP.Net


I have a database that needs restoring to get a website up and running.  I am not a ASP developer (am PHP) and therefore have never used SQL Server before.

I have just tried to import one of the tables from a .txt file using SQL Server Management Studio 8 and instead of the column names being inputed, it just has "column 0", "column 1" etc.  I have noticed that I have a folder full of stored procedures, am I supposed to import these first?  Im not 100% what these stored procedures are for or the best way for me to import all this data successfully as I have so many files it will take forever to import one by one.  I dont mind doing it one by one if I have to but just want to ensure I do it all correctly first time!

Many thanks

View Complete Post

More Related Resource Links

SSRS 2008 Server Exployer not displaying all stored procedures from the database


When I look in the Server Exployer I don't see any of the recently stored procedures that have been developed on the database.  Is there a setting I need to make to be able to see my new stored procedure?

Advanced T-SQL: Automate the Generation of Stored Procedures for Your Database


Design-time automation makes coding faster and ensures that all the procedures generated use the same naming conventions and structure. In an effort to improve their coding efficiency in a large SQL project, the authors wrote a set of design-time stored procedures that generate run-time stored procedures, and have used them in project after project ever since. Recently, the authors updated their procedures to make use of SQL Server 2000 features, including user-defined functions. This article covers the creation and execution of these dynamic T-SQL scripts to automate the coding of common database stored procedures.

Peter W. DeBetta and J. Byer Hill

MSDN Magazine April 2003

Failure in restoring an database from tape - SQL Server 2005

Hello everyone, we are trying to restore one of our datebase from tape using the T-Sql commands. Using the GUI results in an timeout. The command we are using to start the restore is: RESTORE DATABASE RECOV FROM Tape = '\\.\tape0' WITH  FILE=2, RECOVERY, NOUNLOAD, STATS=5, MOVE 'xxx_OPL_xxxx_ZEELAND' TO 'K:\RECOVER\data\RECOV.mdf', MOVE 'xxx_OPL_xxxx_ZEELAND' TO 'K:\RECOVER\log\RECOV_log.ldf', REPLACE the restore proces start without any problem, only ending with this: Processed 2598808 pages for database 'xxx_OPL_xxxx_ZEELAND', file 'xxxx_PROD_Data' on file 2. Processed 3 pages for database 'xxxx_OPL_xxxx_ZEELAND', file 'xxxx_PROD_Log' on file 2. Msg 3229, Level 16, State 2, Line 1 Request for device '\\.\tape1' timed out. Msg 3213, Level 16, State 1, Line 1 Unable to unload one or more tapes. See the error log for details. Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally. In the eventlog, the following is recorded: BackupTapeFile::UnloadTape: PrepareTape(UNLOCK) failure on backup device '\\.\tape0'. Operating system error 21(The device is not ready.). For as far we can judge, the tapedrive is functioning without problems. Using the same tape in an other tapedrive on an different server results in the same error. Hardware used: HP Proliant Server (DL580) with additional SCSI interface card HP StorageWorks LTO 4 tapedriv

Security problem with cross database chaining and stored procedures

I have a situation whereby ProcA exists on database A, but ProcA executes about 20 stored procedures scattered across different databases. To further complicate matters some procs that ProcA calls also call other procs in other databases, this then presents the problem of cross database chaining where you can’t really write to a database from a proc that resides in another database. I am wondering how I can get around this problem, I know I can simply let open cross database chaining and the problem will go away, the other option is to create a proxy which is very complicated and wouldn’t work in my environment. Is there any way around the problem.

Restoring a database on server X but while in a database on server Y

I am trying to execute the following but it always fails. I am on server 'X'. I back up a database on server X, then restore a database on server Y using the newly created backup. The database DB1 exists on both servers of X and Y.How can I execute the intended SQL statements below without errors? I am executing these statements from server X.BACKUP DATABASE [X].[DB1] TO  DISK = N'F:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DB1.bak' WITH NOFORMAT, INIT,  NAME = N'BFI_SCPJD-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10GORESTORE DATABASE [Y].[DB1] FROM  DISK = N'F:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DB1.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10GO

SQL Server 2005 Express Edition - GUI to set permissions on stored procedures

Hi there, I have SQL Serve 2005 Express Edition (Build 2600: Service Pack 3) installed; I also have the Management Console installed. My problem is that I cannot set execute permission, or any other type of permissions on my stored procedures through the GUI, as the Property menu item is missing from the right click menu. I read somewhere that this happens when you have SP1, but as I stated above I have got SP3 installed... Any help?   Regards, D.

SQL Server 2005 Stored Procedures

  I had written a stored proc. to get date & time in Std. format  dd/mm/yy hh:mm:ss AM/PM. I wanted that  when no value is given to the stored procedure it should produce current date & time in the above std. format & when some date is given , it should display that date in above std. format. The stored proc. is as follows: set  ANSI_NULLS ON set  QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[GETDATETIME] @DATE DATETIME = NULL, @NEWDATE VARCHAR(MAX) OUTPUT AS BEGIN --DECLARE @TEMPDATE DATETIME; --SET @TEMPDATE=NULL; --SET @TEMPDATE=; IF (@DATE IS NULL) BEGIN SET @DATE=GETDATE(); SET @DATE=CONVERT(DATETIME,CONVERT(VARCHAR(MAX),@DATE,3)+ ' ' + CONVERT(VARCHAR(MAX),@DATE,24)) ; SET @NEWDATE = convert(varchar(MAX),@DATE, 103)+' ' + CONVERT(VARCHAR(MAX),SUBSTRING(CONVERT(varchar(MAX),@DATE,22),10,12)); GOTO L1; END SET @DATE=CONVERT(DATETIME,CONVERT(VARCHAR(MAX),@DATE,3)+ ' ' + CONVERT(VARCHAR(MAX),@DATE,24)) ; SET @NEWDATE = convert(varchar(MAX),@DATE, 103)+' ' + CONVERT(VARCHAR(MAX),SUBSTRING(CONVERT(varchar(MAX),@DATE,22),10,12)); -- Declare the return variable here --DECLARE @Result int -- Add the T-SQL statements to compute the return value here --SELECT @Result = @p1 -- Return the result of the function --SET @NEWDATE2=CONVERT(VARCHAR(MAX),@NEWDATE); L1: RETURN CONVERT(VARCHAR(MAX),@N

Folders or folder like equivalent in SQL Server 2008 ? for packages & stored procedures ?

Hi,      Currently running SQL-Server 2000.  We have hundreds of stored procedures and DTS packages. We have so many it's becoming a serious challenge for names and such.  We were wondering if SQL Server 2008 has a way to 'nest' both the equivalent of DTS packages (SSIS) and stored procedures in something akin to 'folders'.  We know we have to upgrade one of these days but a version that would handle these would be much more attractive. Just getting this functionality would be worth whatever effort would be required to upgrade.   Thanks in advance for any help on this.

after restoring content database getting error (HTTP/1.1 200 OK Server: Microsoft-IIS/7.5 Date: Tue,

Hi All, Problem i have taken backup of Old site content database procedure see below 1) first i changed the database to read only mode (Opened SQL Server2005-->selected DB--> properties--> Option-->Database Read-Only=True) 2) taken backup of database from the task--Backup(new.bak) 3) Copied the taken backup to new server and restored (Opened SQL Server2005 --> Right Click on Database Folder--> Restore Dataase) In To database: ihave given DB name From Device: i have selected database from the location where i have saved. click ok.  It has restored successfully 4) I have created a new webapplication and removed its content database from central admin. 5) with the help of stsadm command i restored the above db to this webapplication. then iam getting below error: HTTP/1.1 404 Connection: close Date: Tue, 14 Sep 2010 06:20:08 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET MicrosoftSharePointTeamServices: i have refered the below url for restoring http://metahat.blogspot.com/2008/11/backup-restoring-sharepoint-2007-site.html Please help. Thanks in advance.

CLR stored procedures asssemblies working in sql server 2005 but giving issues over sql server 2008

Hi I developed CLR stored procedures assemblies using VS2005 and deployed in sql server 2005 are working fine. Currently we are migrating to sql server 2008. The same CLR assemblies are not working in 2008 version and raising following error. Here i created CLR assemblies in sql server 2008 using 'sa' user account which is having db_owner permission over 'mydatabase'. I am getting an error message like "A .NET Framework error occurred during execution of user-defined routine or aggregate". In sql logs showing messages like as -- Common language runtime (CLR) functionality initialized using CLR version v2.0.50727 from C:\Windows\Microsoft.NET\Framework\v2.0.50727\. -- AppDomain 2 (mydatabase.dbo[runtime].1) created.   Please let me know what may be the cause for this type of issues. Is there any specific backward compatibility settings has to be done over sql server 2008 or sql server 2008 R2 while using 2005 CLR routines?   Thanks in advance.  

Stored procedures not found in Analysis Server

Hi, it seems that my AS2008R2 installation got corrupted and I don't find any way to repair it. AS doesn't "find" stored procedures. Nor stored procedures written by me, nor system stored procedures, nor Data Mining stored procedures. E.g., when I try to browse a Data Mining model I get the following error: Query (1, 6) The '[System].[Microsoft].[AnalysisServices].[System].[DataMining].[AssociationRules].[GetStatistics]' function does not exist. The problem started with my AS2008 installation. I unistalled, then re-installed. Then I upgraded to AS2008R2. Then I repaired the AS2008R2 installation. Nothing ! I don't want to reinstall the server. Please help ! Thanks          Teodoro Marinucci

Restoring Database taking long time in SQL Server 2008 R2 -- some how urgent


Hi all

I have Database size 12GB in SQL Server 2005 and It is backed up.

Now I tring to restore Database in SQL Server 2008 R2(wizard)....it is not at complted after 2hours...still running.


any idea..or help appreciated..



Romanian Texts( a a A  âÎ îS s T t) are not stored properly in SQl Server database

In my application im using romanian language texts also. but these romanian text(a a A   âÎ îS s T t) are not stored properly in the SQL database.
Im using the data type for that field as nvarchar and the collation as SQL_Latin1_General_CP1_CI_AS.

Can anyone help me to resolve this issue.


Restoring content database to another server

I am using sharepoint server 2007,I took a backup of content database and want to restore it to the content databse to another server,without creating a new web application,how can i do this

MS SQL Server Stored Procedure - Writing on a table in another another database


I am writing a stored procedure in a database for an app that will become part of a "shell" program that was written to accept an endless # of VB.Net apps.

The stored procedure will look at data in a table on that database, but the end result is that I want to update a table that exisits in A DIFFERENT database on the same server. I think I am referencing the table itself correctly, (databasename).dbo.(tablename). The problem is that the SQL is not performing as it does if I manually run the SQL in the database I'm trying to update.

Here is the SQL:





/****** Object: StoredProcedure [dbo].[usp_ARReport] Script Date: 10/25/2010 14:43:20 ******/



Permissions on stored procedures in SharePoint_Config database getting revoked




We are getting frequent errors in event viewer for SharePoint server. It occurs in every 1 minute interval.


The exact error text is as follows:

" Insufficient SQL database permissions for user '' in database 'SharePoint_Config' on SQL Server instance 'SQLDBSERVER'. Additional error information from SQL Server is included below.

The EXECUTE permission was denied on the object 'proc_dropObject', database 'SharePoint_Config', schema 'dbo'. "


The steps which we have f

Restoring a content database from another server/AD does not synch user profile information for new


In my SharePoint 2010 beta environment, I have user profiles synching with Active Directory.  I just restored a content database from a separate environment/domain and logged in with my current account.  When I try to create an alert on a library/item, I get the error:

“You do not have an e-mail address.  Alert has been created successfully but you will not receive notifications until valid e-mail or mobile address has been provided in your profile.”

I went to My Profile and found that the My Profile had the right e-mail address (I guess because this is on my My Site Host).

But when I went to My Settings, it did not have any e-mail address for me (I guess this is because it is at the WSS content database level and the e-mail address hasn’t yet synched from the user profile database).

Does anyone the timer job that synchs the user profile with the My Settings for a site collection in a content database?

Issue is posted to my blog with screenshots here:



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend