More Problems Attaching A Database

Nov 16, 2006



Hi Mike,

I've had a look at the white paper on use instances and also stopped using Management Studio, as you suggested. The problem is that I can run my application from VWD quite happily, until for no reason the application can't connect to the database. This happens ramdomly and is very frustrating. I have worked out a way to correct this problem with the following method (I don't know if this is correct but it's the only work around I know.

1) I close down VWD and open Management Studio,

2) I right click to attach a database, and then navigate to the .mdf file for the database, and click to attach it. I then delete the existing icon for that database (which I can't acess anyway, it only shows me the main icon but not the tables)

3) I rename the new instance of the database to the correct name (minus path info etc)

4) I create an SQL script as follows:

EXEC sp_grantlogin 'jonASPNET'

(This line executes correctly),

Then I enter these lines:

USE BalloonShop *name of database *

EXEC sp_grantdbaccess 'jonASPNET'

(At this stage when I execute the query, Management Studio informs me that this name already exists in the database and so doesn't execute)

5) I now close out of Management Studio and re-open VWD, and I can now run my application correctly.

I know I've got some configuration settings wrong somewhere but I find the whole user instance thing confusing. For the record I'm running the appllication through VWD's built in web server, I did originally have it through IIS but I moved it (this will explain the confusion of locations from my first post, I gave you the original location, sorry about that).

Any advice you can give would be gratefully recieved, ie is there an easy way to reconfigure my settings to make everything work as expected or have I got to start the database again from scratch (not a pleasent thought). Also is there an idiots guide to SQL Server Express anywhere that I can read.

Jon

ps I've just realised that I get the 'can't connect to database problem when running the application after I've made a change to the database from VWD ie adding a new stored proceedure, Don't know if this helps, but better you get the full picture.

View 1 Replies


ADVERTISEMENT

Error Attaching Adventureworks Database And SSIS Training Database

Oct 4, 2006

Hi there,

I got this error when i tried to attach the adventureworks database and SSIS training database.

an exception occurred while executing a transact-sql statement or batch
(microsoft.sqlserver.connectioninfo)

could not find row in sysindexes for database ID 17, object ID 1, index ID 1. Run DBCC
checktable on sysindexes.



I join join a network domain for my computer. Previously it doesnt have this problem.

View 1 Replies View Related

Attaching A Database

Apr 2, 2008



The situation :
I am making mass changes to my program and database.
The goal is to not make changes to the database at the customer sites, but to clone their current database, and work with that one.

The solution:
I wrote code and queries to detach the database, copy it to another directory on the same computer with a different name, then attach it with the new name.
The process is:
run : sp_detach_db "' + aDatabase + '", ''false'';' (aDatabase is the original database name)
Then, in code, delete the original .ldf file, and copy the database.mdf file to new directory with new name.
then run (for both the new and the original databases):

Create Database "' + aDatabase + '" on
(NAME = ''' + aDatabase + ''', FILENAME = ''' + FormatFilePath(aPath) + aDatabase + '.mdf''
For Attach

This works, up to a point.
The problem :
When I inspect the properties of the newly attached database, with the new name and new directory, the logical name of the database is still the original name.


I TRIED running this query :
sp_attach_single_file_db @dbName= "' + aDatabase + '",'
@physname= ''' + FormatFilePath(aPath) + aDatabase + '.mdf'

but it returns(even though I have deleted the .ldf files for the original dataset) :
Could not open new database 'Test62'. CREATE DATABASE is aborted.
Cannot create file 'E:Data6Test62Test62_log.LDF' because it already exists. Change the file path or the file name, and retry the operation.
File activation failure. The physical file name "E:Data6TestTest_log.LDF" may be incorrect.

(original database name = data6 est est, new database name is data6 est62 est62)
Is there a way to do this? Or do I just need to give it up?

View 1 Replies View Related

Help Attaching The Database

Oct 11, 2007



hello
i am having a problem attaching database.
The Problem :


I have created a database using sqlserver express edition.now i have installed enterprise edition ,so i am attaching the database which is created in sqlserver express edition into the enterprise edition.it is showing error


TITLE: Microsoft SQL Server Management Studio
------------------------------
Attach database failed for Server 'SRINIVAS'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Could not find row in sysindexes for database ID 13, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'FMS'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
Can anyone Help me

thanks

View 1 Replies View Related

Help - Error In Attaching Database

Jun 12, 2008

i try to attach sqlserver db but i get this error
 
TITLE: Microsoft SQL Server Management Studio Express------------------------------
Attach database failed for Server 'srvsqlsrv'.  (Microsoft.SqlServer.Express.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476
------------------------------ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
------------------------------
One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files.  If this is an existing database, the file may be corrupted and should be restored from a backup. (Microsoft SQL Server, Error: 5173)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2047&EvtSrc=MSSQLServer&EvtID=5173&LinkId=20476
------------------------------BUTTONS:
OK------------------------------
 
 
what i will do to solve this  error

View 1 Replies View Related

Attaching A Removable Database

Dec 1, 2000

Hi,

I wanted to create a removable SQL Server 7.0 database. So I created the database using the sp_create_removable system stored procedure, imported objects and data, ensured that the database is configured properly for distribution on removable media (using sp_certify_removable system stored procedure), and detached it from original SQL Server. So far, so good. The database consists of 3 files: MYDB_SYS, MYDB_DATA and MYDB_LOG. I copied
MYDB_DATA on a CD, and MYDB_SYS and MYDB_LOG on hard disk of a different server. If I execute the following statement:

Execute sp_attach_db
@dbname = 'MYDB'
, @filename1 = 'C:MYDB_SYS.MDF'
, @filename2 = 'E:MYDB_DATA.NDF'
, @filename3 = 'C:MYDB_LOG.LDF'

I get the following messages:

Server: Msg 5105, Level 16, State 4, Line 1
Device activation error. The physical file name 'E:MYDB_DATA.NDF' may be incorrect.
Server: Msg 945, Level 14, State 1, Line 1
Database 'MYDB' cannot be opened because some of the files could not be activated.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'MYDB'. CREATE DATABASE is aborted.

I can successfully execute the above statement if I make MYDB_SYS.MDF file read only, but then MYDB is created as read only, and this option can not be changed.

Please, help.

Maja

View 1 Replies View Related

Problem In Attaching Database

May 26, 2007

Hi all,
I am facing a problem during attaching a database (.mdf and .ldf files are copied fro another server). the message I am getting as follows:

messages was from 'Microsoft SQL Server Management Studio Express':

===================================

Attach database failed for Server 'CTPL-1'. (Microsoft.SqlServer.Express.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.Exceptio nTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
Program Location:

at Microsoft.SqlServer.Management.Smo.Server.AttachDa tabase(String name, StringCollection files, String owner)
at Microsoft.SqlServer.Management.SqlManagerUI.Attach DatabaseData.PrimaryFile.Attach()
at Microsoft.SqlServer.Management.SqlManagerUI.Attach Database.SendDataToServer()

===================================

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)

------------------------------
Program Location:

at Microsoft.SqlServer.Management.Common.ServerConnec tion.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Common.ServerConnec tion.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManage r.ExecuteNonQuery(StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Server.AttachDa tabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions)
at Microsoft.SqlServer.Management.Smo.Server.AttachDa tabase(String name, StringCollection files, String owner)

===================================

Could not find row in sysindexes for database ID 8, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'mci'. CREATE DATABASE is aborted. (.Net SqlClient Data Provider)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476

------------------------------
Server Name: (local)
Error Number: 602
Severity: 21
State: 50
Line Number: 1


------------------------------
Program Location:

at System.Data.SqlClient.SqlConnection.OnError(SqlExc eption exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQuer yTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNo nQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.SqlServer.Management.Common.ServerConnec tion.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)

===============================================


********************************

the followings are the command and mesage from Query Analyzer:

*****************************************

command:

-- =============================================
-- Attach database via sp_attach_db
-- =============================================
EXECUTE sp_attach_db @dbname = N'mci',
@filename1 = N'd:ifgldatabasemci.mdf',
@filename2 = N'd:ifgldatabasemci_log.ldf'
GO

*****************************************

message:

Server: Msg 602, Level 21, State 50, Line 1
Could not find row in sysindexes for database ID 8, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Connection Broken

*******************************************




I am new to MS SQL Server and unable to solve the problem. Can anyone help me in this metter.

Thanks in advance.

View 2 Replies View Related

Attaching BAK File On Database

Apr 12, 2013

there was a failure due to power shutdown,and the .mdf and .ldf files on the DB is not longer available. there is a backup done 5days ago with the title nice_cls.BAK. How do i restore or reattach the .bak file on the NICE-CLS database.

View 10 Replies View Related

Attaching Database On Create

Feb 22, 2004

Hi,

My current server going nuts it restaring every one hour, I have 200+GB (80+ files) database size. The network guyes don't have backup. This is what I am trying to do. I have detach my database. I have copied all the file to new server. Now i am trying to attach using create, I can't just use attach because 16+ files. When I run following on my server it gives me an error.

Any help will be highly appreciated.

please email me the answer if you have.

Thanks.

Samir

CREATE DATABASE KEYFILE
ON PRIMARY (NAME= 'KEYFILE001' FILENAME='F:KEYFILEDBKEYFILE001.MDF')
ON SECONDARY (NAME='KEYFILE002' FILENAME='F:KEYFILEDBKEYFILE002.NDF')
ON SECONDARY (NAME='KEYFILE003' FILENAME='F:KEYFILEDBKEYFILE003.NDF')
ON SECONDARY (NAME='KEYFILE004' FILENAME='F:KEYFILEDBKEYFILE004.NDF')
ON SECONDARY (NAME='KEYFILE005' FILENAME='F:KEYFILEDBKEYFILE005.NDF')
ON SECONDARY (NAME='KEYFILE006' FILENAME='F:KEYFILEDBKEYFILE006.NDF')
ON SECONDARY (NAME='KEYFILE007' FILENAME='F:KEYFILEDBKEYFILE007.NDF')
ON SECONDARY (NAME='KEYFILE008' FILENAME='F:KEYFILEDBKEYFILE008.NDF')
LOG ON SECONDARY (NAME= 'KEYFILE_LOG' FILENAME='F:KEYFILEDBKEYFILE_LOG.LDF')

FOR ATTACH

View 1 Replies View Related

Error While Attaching Database

Jul 19, 2006

hi all
i am working on sql server 2005
When i am trying to attach database in my server i am getting following error. Plz help me to fix this error.
the error as as follows :

Attach database failed for Server 'myserver'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Could not find row in sysindexes for database ID 10, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'ReportServer'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)

View 2 Replies View Related

Error While Attaching Database

Jul 19, 2006

hi all
i am working on sql server 2005
When i am trying to attach database in my server i am getting following error. Plz help me to fix this error.
the error as as follows :

Attach database failed for Server 'myserver'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Could not find row in sysindexes for database ID 10, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'ReportServer'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)

View 1 Replies View Related

SQl 7.0 Issue While Attaching A Database

Oct 12, 2005

Hi,I am tring to attached a database in SQL using the following command.Can any one please help. Basically I have a MDF and LDF files which Ineed to open in SQL 7.0, these files are from a diff SQL7.0 machinewhich is crashed.PLEASE HELP. There are many valuable info in the database.Command :EXEC sp_attach_db @dbname = N'Digitalindia',@filename1= N'C:SqlMaster.MDF',@filename2= N'C:SqlMaster.LDF'Error :Server: Msg 5172, Level 16, State 15, Line 1The header for file 'C:SqlMaster.MDF' is not a valid database fileheader. The PageAudit property is incorrect.*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

Attaching A Database Without A Log File

Jul 20, 2005

Hiis it possible to attach a database when a log file is missing?My database had one .MDF file and 2 .LDFs. I lost one of the .LDFs. Is itpossible to recover any data?Tegie

View 1 Replies View Related

Attaching And Detaching A Database

Jul 20, 2005

Q1.)In SQL Server 2000, is it always possible to use copies of thedata and transaction log files of a database from one server toreattach to a new database on another server, or even to the sameserver, without first detaching from the existing database?Books Online says that detaching a database closes the data and logfiles cleanly. I read some where that some times, it is possible toattach without detaching, if the data and log file are in stablestate.This is what I tried - Tried to copy Northwind.mdf and ldf files usingwindows explorer and it gave an error message that the files are inuse. I shutdown the server and now I could easily copy them. Afterthat I renamed these files and successfully attached them as a newdatabase.Q2.)Is it possible to do the same with large production databases?Q3.) Please explain what goes on during detaching /attaching process.Thanks in advanceRavi

View 1 Replies View Related

Attaching AdventureWorks Database

Mar 21, 2007

Today I installed SQLEXPR.EXE that I found here:

http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476

I made sure that I downloaded the 64-bit version.

I then wanted to download and install the Adventure Works database located here: http://www.microsoft.com/downloads/details.aspx?familyid=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en

Since I am running Vista 64-bit, I downloaded and installed AdventureWorksDB_x64. It wouldn't install. I got "Access is denied" and CREATE FILE error plus several others.

I then uninstalled it and downloaded AdventureWorksDB - this is the X86 version. It installed fine.

Can anyone explain what am I missing? Thanks!

View 1 Replies View Related

Attaching Database Without Ldf File?

Jul 24, 2007

Hi all,
I have deleted the .ldf file now i am having only the .mdf file. Is it possible to attach the database without shutdown the sql server.
Thanks.

View 9 Replies View Related

Problem Attaching A Database

May 4, 2006

I've created a simple database using Visual Web Developer Express.

I is located in "C:Documents and SettingsRomanMy DocumentsVisual Studio 2005WebSitesNewSiteApp_Data" Folder.

When I try to attach this database using SQL SERVER Management Studio Express: it doesn't allow me to view the contents of "C:Documents and SettingsRoman" Folder - it just won't expand any further!!!!!

Anyone had a similar problem. I think it is some sort of a bug, maybe

Please help!

Thanx

Michael

View 1 Replies View Related

Problems Attaching To Database From VWD

Nov 7, 2006

Hi Mike,

I hope you can help me with my SQL Server Express problem. I have a database that was created in VWD Express 2005, that is currently in C:web projectsproject nameApp data...etc. I have been able to connect to and use the database with an application that I am building as a learning exercise, ( I'm a complete newbie to .NET and SQL Server) but now I can't connect to the database from SQL Server manager.

I have tried attaching the file which has worked a few times, but now that won't work either. I keep getting a message that the file can't be found or I do not have sufficient permissions to access it. I can connnect to the file fine from within VWD, but because of the above problem I can't now run the application (it throws an exception).

I suspect that I've got some of the basic configuration settings wrong, but I really don't know where to start looking. Below is an example of one of the messages I've been getting

Failed to retrieve data for this request. (Microsoft.SqlServer.Express.SmoEnum)
CREATE FILE encountered operating system error 32(error not found) while attempting to open or create the physical file 'C:InetpubwwwrootBalloonShopApp_DataBalloonShop.mdf'. (.Net SqlClient Data Provider)

Any help would be very gratefully recieved

regards

jon

View 7 Replies View Related

Error On Attaching A Database

Jan 4, 2006

When attaching a database that was detached  from another SQL Server instance(copied raw .mdf and ldf files)..

I got the error message below:

Error 602: Could not find row in sysindexes for database ID 25, object ID 1,
index ID 1. Run DBCC CHECKTABLE on sysindexes.

how can i solve this problem. i am using SQL Server 2000

Thanks and Regards

View 4 Replies View Related

Attaching A Database To Sql Express

Aug 4, 2006

I'm trying to attach a database to sql express with the following code from the management tool. I keep getting an error message. An someone explain what I'm doing wrong.



Msg 102, Level 15, State 1, Line 9

Incorrect syntax near '<'.

IF NOT EXISTS(

SELECT *

FROM sys.databases

WHERE name = N'<northwind.mdb, I4V0Y6SQLEXPRESS, northwind>'

)

CREATE DATABASE <database_name, sysname, your_database_name>

ON PRIMARY (FILENAME = '<c:my documentsmy websmyweb3,,C:Program filesMicrosoft SQL ServerMSSQL.1MSSQLDataorthwind.MDF>')

FOR ATTACH

GO



Ira

View 1 Replies View Related

SQL Server Express...Attaching DataBase

Apr 14, 2007

Howdy Folks,
I have a site on WS2003, IIS 6 installed on c:.
I put the site in a folder on d:. Nothing else is on d: except the web site.
I added a new website in IIS and pointed to the site on d:.
Using the default connectionString in machine.config, I am unable to connect to ASPNETDB.MDF. Therefors, I can not log in.
In SQL Server Management Studio Express, I attached ASPNETDB.MDF. I then am able to log in.
Does ASPNETDB.MDF have to be manually attched like this when the web site is located on a drive othr than where IIS is installed and running?
Thanks

View 6 Replies View Related

Attaching An .mdf Database To SQL Server 2005

Sep 19, 2007

Hi
 

I need your help in attaching an .mdf database (Created in SQL Server 2005 in another computer) to SQL server 2005. I tried the original way (right click>attache), but all I get is the following:

View 9 Replies View Related

Recovery/attaching Database Files

Jun 2, 2006

hello, (this was originally posted in Administration Forum)

I am helping out with a disaster recovery of a database and i was given 4 files. 2 MDF and 2 LDF files. When I try to attach the files to SQL Server I recieve this err msg:

Server: Msg 823, Level 24, State 6, Line 1
I/O error (torn page) detected during read at offset 0000000000000000 in file 'E:chivirtualGPS0Dat.mdf'.
Connection Broken

I then tried many other combinations hoping something would work --> tried individual files, just data files, tried to create a new DB and then switching/replacing out with the files i needed...etc, nothing seems to work for me. The people I am trying to help out do NOT have backups.

Any thoughts would be appreciated. thanks...

View 7 Replies View Related

Error In Creating Or Attaching Database

Dec 6, 2006

I was getting following error while creating a database or attaching a database to sql server 2005

"The file <<*.mdf>> is compressed but does not reside in a read-only database or filegroup.."

In this scenario, if you try sp_attach_db procedure, you get following error:
Msg 5118, Level 16, State 1, Line 1

After
little bit of troubleshooting, I found this was happening because of a
folder option (of the folder where database file reside (in case of
attach) or being created (in case of create)).

Go to folder
properties, General Tab, click on Advanced button,check "Compress or
Encrypt attributes" section. If the first option (Compress contents to
save disk space) is checked, you get that error. Uncheck it to fix that
problem.

View 1 Replies View Related

Syntax Error Attaching Database - T-SQL

May 20, 2008

Hi all,

I'm trying to attach a database file and it's associated database log file to SQL Server. However I am using the 'SQLDataRoot' value from the registry to determine the absolute path to the DB file and DB log file. Like so...

USE [master]

DECLARE @RC int

/* read path to SQL Server Express Data directory from registry */
DECLARE @sql_server_data_dir sysname
EXEC @RC = master..xp_regread N'HKEY_LOCAL_MACHINE',N'SOFTWAREMicrosoftMicrosoft SQL ServerMSSQL.1Setup',N'SQLDataRoot', @sql_server_data_dir OUTPUT
SET @sql_server_data_dir = @sql_server_data_dir + N'Data'

CREATE DATABASE [PROJECT_DB] ON
(FILENAME = '''' + @sql_server_data_dir + 'PROJECT_DB.mdf'''),
(FILENAME = '''' + @sql_server_data_dir + 'PROJECT_DB_log.ldf''') FOR ATTACH;

GO

I have also tried using the sp_attach_db stored procedure as follows

EXEC @RC = dbo.sp_attach_db 'PROJECT_DB',
'''' + @sql_server_data_dir + 'PROJECT_DB.mdf''',
'''' + @sql_server_data_dir + 'PROJECT_DB_log.ldf'''

They both the error:

Msg 102, Level 15, State 1, Line 18
Incorrect syntax near '+'.

The quotes in the calls are single quotes not double quotes in case someone queries that. Thank you.

Regards,
Paul

View 3 Replies View Related

Detaching And Attaching A Database For My Project

Mar 22, 2008

I hope this is the right forum for this question.

I am working with an asp.net project in Visual Web Developer 2005 Express. This is a starter kit project. There is a database that came with the project that I want to open up in the SQL Server 2005 Express management studio so that I can modify it.

I have detached the db in the VWD environment.But, I do not see this db in the db folder with in the SQL Server studio's IDE. I am assuming that I have to attach the database to the SQL Server management studio in order to work with it. Is this the correct way to do this type of thing? Is there a better way of doing it(a stored proc like mentioned below)?

I also have a question about the icons that pertain to this situation. I have noticed two variations of the same icon. I want to be sure I am interpretting these correctly. I am assuming that the icon that is a cylinder representing a db with the little
electrical plug coming out from behind it means that the db is attached. There is another version of this icon that has a red "x" over the plug. I am assuming that this means it is detached. Is this correct?

I have attached and detached dbs in Sql Server Express. Is the process the same for doing this with a project in Visual Web Developer? Is there a stored proc that I can use to detach from the SQL Server 2005 environment after I have made a database and attach this to my project in VWD in one step?

-thanks in advance

View 4 Replies View Related

4 Websites Broke, When Attaching Database In SQL Man Studio.

Dec 27, 2007

If I create a website in VWD express and create a database in the APP_DATA folder it works great.  Then if I attach it in SQL Management Studio,  when I go back to opening the website I get MyMachineaspnet can not log into database.  Even if I copy the database.mdf file of a working site  to a different folder,  rename it,  attach it.  The original website fails to open the original database.  With out changing anything. If it's a DNN website it returns Website currently unavalable.  After this happens I can in VWD open and see the tables in the database.  I think databases created in the APP_DATA folder in VWD are "User Instances" I don't normally see them in SQL management Studio.  Something about the Studio breaks them.
This is getting old real quick so PLEASE tell me what am missing here.  Thanks
-KK
 

View 2 Replies View Related

Attaching Database To Sql 2000 Personel Eddition

Feb 6, 2008

Hi,
I m going to attach my databse file to newly installed sqlserver 2000 personel eddition. But when I click the ok button (right click on the database> alltasks> attachdatabase> ). I found the error like
Error 602: Could not find row in sysindexes for database ID 7, Object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Can anyone tell me how can I do this to attach database.



Navi

View 3 Replies View Related

Problems While Attaching A Database In SQLServer 2000

Nov 29, 2006

Dear all,

I recive a error when i attaching a database in sqlserver 2000. The error is :-

An exception occurred while executing a T-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

Could not find row in sysindex for databases ID 12, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexs.

Could not open new database 'ABC'. Create Database is aborted. (Microsoft SQL Server, Error: 602)



View 5 Replies View Related

Error When Attaching Adventure Works Database

Oct 14, 2006

Hello Everyone,

I am very new to SQL and just completed an install of SQL 2005 Express. After install, I downloaded the Adventure Works database and attempted to attach through both the Object Browser (right-click 'Databases'--->'Attach') and by running the script that is located on the SQL download page where I got the Adventure Works db.

Here's the error that I get:

"Could not find row in sysindexes for database ID 8, object ID 1, Index ID 1. Run DBCC CHECKTABLE on sysindexes."

I have attempted to go through the help files, but unfortunately the above message is too cryptic for me and I have no idea what it's telling me.

Can someone help?

Thanks!!

View 6 Replies View Related

Attaching A Valid Database Fails Because Of Old Mdf-files

Sep 3, 2007



I have a database that consists of 4 files (1 MDF, 2 NDF's and 1 LDF-file). I can confirm that by running:

select name from sys.database_files

The result is:
Adam_Data
Adam_Log
Adam_FullText
Adam_History


About a year ago this database had 3 more NDF-files, but we moved all the objects that were stored in these secondary datafiles to the other datafiles and removed them completely from the database. This operation worked correctly otherwise the sys.database_files view would have returned more files I assume.

Everything works perfectly with this database until I try to detach and reattach it. If I detach this database and immediately try to attach it again on the same server using Sql Server Management Studio it wants me to attach 7 database files! The 4 database files that are still being used by this database (which is perfectly valid), but it also wants me to attach the 3 old database files which obviously don't exist anymore and that aren't even reported by the sys.database_files view. Is there anything I can do to make sure that an attach of this database will work again? How can I completely remove these old database files?

Regards,
Michael

View 8 Replies View Related

Installing SQL 2005 Express And Attaching Database From CD

Apr 11, 2007

Hi there,



I have created an .iss file which when compiled creates a setup.exe file on a cd rom. Within the .iss I have extracted the sqlexpress files out so that it will install straight from disk to the users machine rather than from the .msi file. All this has been successful so far....



My problem is:- I want to attach a database to the an instance of sqlexpress on the users machine. I have detached it from SQL Server 2000 and copied it over to the cd. The setup file copies these over the users hard drive. I have looked through many forums etc and the words that keep popping up are:-



sqlcmd.exe

template.ini

type into the command prompt.



Sorry if I'm a little ignorant but I am not sure how to go about these. How do I open the command prompt on the users machine from CD? Do I have to create something to do this?



Any information would be appreciated, any guidance or scripts would be great.



Regards

Sam

View 2 Replies View Related

Attaching SQL 2000 Database (.mdf) With Missing (.ldf) File

Mar 27, 2007

Hello



Please can anyone help me



I've been given a .mdf file from sql server 2000 which i need to attach but we do not have the .ldf file



I am unable to recover the old .ldf file



I have tried the attach single file command but obvioulsy this still looks for the old .ldf file path which no longer exists



any help would be mostly appriciated



many thanks



Martin

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved