by Administrator
2. November 2009 23:56
This one caused a bit of a panic I can tell you! We had major trouble reattaching a very large database file. We kept getting the error below (Running SQL 2008 on Windows 7):
Unable to open the physical file Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)". (Microsoft SQL Server, Error: 5
This occured both when using the Management Console and if running the stored procedures 'sp_attach_db' and 'sp_attach_single_file_db'
Solution
Not sure if there is a 'better' way of doing this but we found that connecting using 'sa' and attaching the database as normal solved the problem
by Administrator
23. October 2009 20:06
Easy one this, if you're trying to insert rows with specific values to go into an identity column (e.g. when transferring data from one database to another) you need to use the following kind of statement
SET IDENTITY_INSERT tablename ON
INSERT INTO tablename (column1, column2)
SELECT column1, column2 FROM table2
SET IDENTITY_INSERT tablename OFF