Showing posts with label attach. Show all posts
Showing posts with label attach. Show all posts

Friday, March 23, 2012

How Can I automatic create all that Objects in assembly in simple way ?

Hi

I use SQL code snippet to attach the CLR assembly (dll) to the SQL Server Express

CREATE ASSEMBLY [DatabaseAndImages]

AUTHORIZATION [dbo]

FROM 'C:\CLR_File.dll'

WITH PERMISSION_SET = SAFE

That file content CRL Codes for 10 Stored Procedures & 3 UDT & 5 Functions & 6 Triggers

As you can see it's content large amount of DB objects !!

My Question is ..

Is there any simple way can I use it to extract or automatic create all that Objects in the Database without use separate SQL Statement for each one ?

By Example , I will use this SQL statement to create the sp_AddImage that already located inside the CLR dll file

CREATE PROCEDURE [dbo].[sp_AddImage]

@.ImageID [uniqueidentifier],

@.ImageFileName [nvarchar](max),

@.Image [varbinary](max)

WITH EXECUTE AS CALLER

AS

EXTERNAL NAME [DatabaseAndImages].[StoredProcedures].[sp_AddImage]

But as you know .. I have many objects .. and I am in development phase and I will do change to that object many time and also may I will add much more …

I thing it's not good to write SQL Statement for each object and do changes every time when I change the object definition

Is there any one line of SQL statement can I use it to automatically create and extract all the objects inside the assembly ?

Or is there any way to do that Issue by simple operation ?

And thanks with my best regarding

Fraas

If you use Visual Studio 2005; it has this new project type: the Sql Server Project which allows you tol do automatic deployment of the assembly as well as creation of the objects. It has it's limitations though - only for VS 2005 Professional and above, and it can not do ALTER (it always re-deploys everything), and it doesn't script out the objects. But as I said, it does automatic deployment.

If you want the ability to script out the objects, etc you can try a project type (and deployment mechanism) I wrote as an add-in to Visual Studio. You can find more info here.

Niels|||

Hi Fraas,

This blog post: http://blogs.msdn.com/sqlclr/archive/2005/11/21/495438.aspx details a ddl trigger that will create all the objects in your assembly when you create it. This hopefully will solve your problem without requiring Visual Studio.

Steven

sql

Wednesday, March 21, 2012

How can I attach the ASPNETDB mdf to SQL 2005?

I want to import a table and data in SQL 2005 to the table in the ASPNETDB mdf. Please help.

Do you know where the database is?

I would recommend you to read this series to get start. You will be there.

http://aspnet.4guysfromrolla.com/articles/040506-1.aspx

|||Dumb Questions...what do I type in to get here...navigate to%WINDOWS%\Microsoft.NET\Framework\v2.0.50727|||I figured that out. How do I runaspnet_regsql.exe|||double click on it.sql

HOW CAN I ATTACH DATABASE TO MSDE ?

I am having little problem with it , I am using installshield for setup program and at the end when I finish with msde installation I try to attach a database, I would like to use SQL-DMO , but I dont have much clue how can I do it I need some examples sc
ripts
Thanks a lot
While you can use SQL DMO, it's really easier to simply use ADO or ADO.NET.
When you "open" a database connection against SQL Server and point to the
MDF file, ADO does an attach for you (unless the database is already
attached). This code is from a yet-to-be-published article on SQL Server
Express where I attach a new database to the local SQLEXPRESS named
instance.
Try
cn = New SqlConnection("Data Source=.\SQLExpress;" _
& "Integrated Security=True;Database=Biblio;" _
& "Timeout=60;" _
& "Application Name=SQLExpress Test;" _
& "AttachDBFilename=" & strFn)
da = New SqlDataAdapter("SELECT AU_ID, Author, Year_Born from
authors", cn)
ds = New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
hth
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Robert" <Robert @.discussions.microsoft.com> wrote in message
news:1F642E5F-37AB-4BA7-88DF-5159C607AA0C@.microsoft.com...
> I am having little problem with it , I am using installshield for setup
program and at the end when I finish with msde installation I try to attach
a database, I would like to use SQL-DMO , but I dont have much clue how can
I do it I need some examples scripts
> Thanks a lot
>
|||Hello Robert.
U have said th@. u installed MSDE 2000 using installsheild. How did u do this. Pls help me as im unable to install MSDE itself. Also its givin me a message a strong SA id and password is required.
"Robert" wrote:

> I am having little problem with it , I am using installshield for setup program and at the end when I finish with msde installation I try to attach a database, I would like to use SQL-DMO , but I dont have much clue how can I do it I need some examples
scripts
> Thanks a lot
>

How can I attach database files from outside the local server?

Hi,all here,

I got a problem that I can only attach database files created on my local server, while database files from outside the local server cant be attached. So what is the problem then?

Thanks a lot in advance for any guidance and help.

Which error do you get ?

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||

Hi, Jens, the error I always got is as below:

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

Thanks a lot.

|||Any help? Thank a lot.|||

it happened to me that I was not able to re-attach database when logged in to the server under login B, different from login A used to detach the database. Login A also happened to be a dbo for this database.

try this:

1) re-attach the files to their original server,

2) create a new login that log in using SQL authentication,

3) set this login a dbo for the database you are transferring

4) on the new PC, create the same login (with the same pwd), assign it a sysadmin role, and log into the server with this login

5) try again attaching the file(s).

|||Hi, Lolik, thanks a lot.

How can I attach AdventureWorks Database to SQL Server Management Studio Express?

Hi all,

I just downloaded AdventureWorks_Data.mdf, AdventureWorks_Data.ldf, AdventureWorksDW_Data.mdf, and AdventureWorksDW_Data.LDF files to the C:\Program Files\Microsoft SQL Server\MSSQL.1|\MSSQL\Data folder of my Windows XP Pro PC. I tried to attach the AdventureWorks database in my SQL Server Management Studio Express in the following way: I clicked on SQL Server 2005 Express=>SQL Server Management Studio Express=>Right clicked on Databases=> clicked on "Attach..."=> "Attach Databese" showed up. But I can not type in anything under the MDF File Location, Database Name, Attach As, Owner, Status, Message!!!? What is wrong in my way of doing the attachment of AdventureWorks database (described above)? Please help and advise.

Thanks,

Scott Chang

P. S. I do not have Microsoft Visual Studio 2005. Walkthrough: Install the AdventureWorks Database (http://msdn2.microsoft/en-us/library/ms31035.aspx) : To confirm your SQL Server data directory (Start=>All Programs, Microsoft Visual Studio 2005, Visual Studio Tools, Visual Studio 2005 Command Prompt) steps 1 thru 4 can not be applied to my SQL Server Management Studio Express. I read an SQL Express post dated 19 April 2006 and learned the above-mentioned way to attach the AdventureWorks database in the SQL Server Management Studio Express. But that way does not work for me.

Hi Scott,

You can't type in the name of the database, you need to click the Add button, which will open a browse window onto the Data folder, where you can select the MDF file you desire. Once added, you can click OK to complete the attach.

Mike

|||

Why are some folders unbrowsable in SSMSE? I have an .mdf file located under c:\documents and settings\myusername\blah blah blah.... and when I try to browse to my mdf file I get no further than c:\mydocuments\myusername. As if there are no subfolders. Is this a folder rights issue?

|||

Yes, it's a folder rights issue.

SQL Express runs as the Network Service account, which doesn't have permissions to any of the User profile directories such as My Documents. If you want to have your database always attached to SQL Express and available to everyone, then you should put the file in the SQL Data directory and attach it from there. If you want the database to be reserved for just a single user, then I would suggest you explore User Instances, which is a special way to run SQL Express under specific users accounts so that it does have permission to the User profile directories.

User Instances are used by default when you insert a database into a Visual Studio project. You can find more information here.

Mike

How can I attach AdventureWorks Database to SQL Server Management Studio Express?

Hi all,

I just downloaded AdventureWorks_Data.mdf, AdventureWorks_Data.ldf, AdventureWorksDW_Data.mdf, and AdventureWorksDW_Data.LDF files to the C:\Program Files\Microsoft SQL Server\MSSQL.1|\MSSQL\Data folder of my Windows XP Pro PC. I tried to attach the AdventureWorks database in my SQL Server Management Studio Express in the following way: I clicked on SQL Server 2005 Express=>SQL Server Management Studio Express=>Right clicked on Databases=> clicked on "Attach..."=> "Attach Databese" showed up. But I can not type in anything under the MDF File Location, Database Name, Attach As, Owner, Status, Message!!!? What is wrong in my way of doing the attachment of AdventureWorks database (described above)? Please help and advise.

Thanks,

Scott Chang

P. S. I do not have Microsoft Visual Studio 2005. Walkthrough: Install the AdventureWorks Database (http://msdn2.microsoft/en-us/library/ms31035.aspx) : To confirm your SQL Server data directory (Start=>All Programs, Microsoft Visual Studio 2005, Visual Studio Tools, Visual Studio 2005 Command Prompt) steps 1 thru 4 can not be applied to my SQL Server Management Studio Express. I read an SQL Express post dated 19 April 2006 and learned the above-mentioned way to attach the AdventureWorks database in the SQL Server Management Studio Express. But that way does not work for me.

Hi Scott,

You can't type in the name of the database, you need to click the Add button, which will open a browse window onto the Data folder, where you can select the MDF file you desire. Once added, you can click OK to complete the attach.

Mike

|||

Why are some folders unbrowsable in SSMSE? I have an .mdf file located under c:\documents and settings\myusername\blah blah blah.... and when I try to browse to my mdf file I get no further than c:\mydocuments\myusername. As if there are no subfolders. Is this a folder rights issue?

|||

Yes, it's a folder rights issue.

SQL Express runs as the Network Service account, which doesn't have permissions to any of the User profile directories such as My Documents. If you want to have your database always attached to SQL Express and available to everyone, then you should put the file in the SQL Data directory and attach it from there. If you want the database to be reserved for just a single user, then I would suggest you explore User Instances, which is a special way to run SQL Express under specific users accounts so that it does have permission to the User profile directories.

User Instances are used by default when you insert a database into a Visual Studio project. You can find more information here.

Mike

how can i attach access database to MSDE??

I have an mircosoft access database, but now i want to attach it to MSDE, how can i do impliment this??

i already try to use the following commands
exec sp_attach_db 'example','c:\example.mdb'

but i got the following error message
The header of this file 'c:\example.mdb' is not a valid database file header. The FILE SIZE property is incorrect.sp_attach_db is not what you need. You need to create a linked server. Seesp_addlinkedserver.

Terri|||thanks very much
i have use this command to add the access database as follow:
EXEC sp_addlinkedserver
@.server = 'example',
@.provider = 'Microsoft.Jet.OLEDB.4.0',
@.srvproduct = 'OLE DB Provider for Jet',
@.datasrc = 'C:\example.mdb'
GO

but the output is: 1 row affected
1 row affected
however in the sp_serverlinkedserver man page say it should return:server added

and i can not see example database after i performe the above command.|||i also have question
1.how can i access the database after sp_addlinkedserver
2.can i create stored procedures to this database which is sp_addlinkedserve(ed) access database|||Sorry, you've exhausted the extent of my knowledge on the subject. :-) I've only done this with Excel and other SQL Servers myself.

Terri|||that's all right
i just want to ask when you sp_addlinkedserver with Excel or other SQL server, where can you find you database(the one you just inported)?or how can you use you database|||

Dear friends,

I need some help. Here is what I am trying to do.

I have inserted and Excel object as an ActiveX control on my aspx page. When this page is opened, I do see the Excel control. - but blank.
What I would like to know, is how to specify an Excel file ( e.g MyFile.xls) that should appear in the control when the page is opened. I have tried with the properties available on the control, but with no luck.
Your help will be very helpful.
Thanks.
Mwan

sql

How can i attach a SQLServer2005 db to an instance of SQLServer 2000?

i have a db that created in sql2000 and then iattached it to sqlserver 2005 ,now i want to attach this db to sql server 2000 again,but when i do that i get an error message and the attach process fails.plz help me and show me a way to attach this db.

Short answer: you can't :-(
Once you have attached it to SQL Server 2005 it is no longer compatible with the SQL Server 2000 file format.

Monday, March 12, 2012

How bad is this??

After detaching a database and deleting the logfile, I use
sp_attach_single_file_db to attach the database and get the following error:
Could not open new database 'Orders'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'F:\'Orders' may be
incorrect.
Is there any way to recover without the log file now?
> After detaching a database and deleting the logfile
Can I ask why you would ever do this?
http://www.aspfaq.com/
(Reverse address to reply.)
|||You have any backups of the database or database files?
"Bryan" <bryan.charlton@.api-wi.com> wrote in message
news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> After detaching a database and deleting the logfile, I use
> sp_attach_single_file_db to attach the database and get the following
error:
> Could not open new database 'Orders'. CREATE DATABASE is aborted.
> Device activation error. The physical file name 'F:\'Orders' may be
> incorrect.
> Is there any way to recover without the log file now?
>
>
>
>
>
|||Also, is your Resume up to date?
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Joe" <JoeD777@.lycos.com> wrote in message
news:uZ7y3yRZEHA.3420@.TK2MSFTNGP12.phx.gbl...
> You have any backups of the database or database files?
>
> "Bryan" <bryan.charlton@.api-wi.com> wrote in message
> news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> error:
>
|||Yes, I have a backup that I can restore from. This is my only option I take
it?
"Joe" <JoeD777@.lycos.com> wrote in message
news:uZ7y3yRZEHA.3420@.TK2MSFTNGP12.phx.gbl...
> You have any backups of the database or database files?
>
> "Bryan" <bryan.charlton@.api-wi.com> wrote in message
> news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> error:
>
|||I have actually done this more times than I can count when moving
development databases from server to server and have never had a problem
(until now).
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OQl33yRZEHA.716@.TK2MSFTNGP11.phx.gbl...
> Can I ask why you would ever do this?
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
|||> I have actually done this more times than I can count
Move the data and the log file. Or, backup and restore. What you're doing
is quite similar roulette, and you've merely been on a lucky roll until this
spin.
http://www.aspfaq.com/
(Reverse address to reply.)
|||> Yes, I have a backup that I can restore from. This is my only option I
take
> it?
Or, you can call PSS.
|||Isn't it possible that the physical file name really is incorrect, as the
error says? Are you sure it isn't 'F:\'Orders.mdf' instead of 'F:\'Orders'?
You don't need the log file to attach the DB.
-John Oakes
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:Omp91KSZEHA.1048@.tk2msftngp13.phx.gbl...
> Move the data and the log file. Or, backup and restore. What you're
doing
> is quite similar roulette, and you've merely been on a lucky roll until
this
> spin.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
|||theoretically he should have been alright
Inside SQL 2000 "One benefit of using the sp_detach_db procedure is that SQL
Server will know that the database was cleanly shut down, and the log file
does not have to be available to attach the database. SQL will build a new
log file for you. This can be a quick way to shrink a log file that has
become much larger than you would like, because the new log file that
sp_attach_db creates for you will be the minimum sizeless than 1 MB. Note
that this trick for shrinking the log will not work if the database has more
than one log file."
But you're right he should have been a bit more careful on a production
server. P45 time!
Br,
Mark Broadbent
mcdba , mcse+i
=============
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:Omp91KSZEHA.1048@.tk2msftngp13.phx.gbl...
> Move the data and the log file. Or, backup and restore. What you're
doing
> is quite similar roulette, and you've merely been on a lucky roll until
this
> spin.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>

How bad is this??

After detaching a database and deleting the logfile, I use
sp_attach_single_file_db to attach the database and get the following error:
Could not open new database 'Orders'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'F:\'Orders' may be
incorrect.
Is there any way to recover without the log file now?> After detaching a database and deleting the logfile
Can I ask why you would ever do this?
http://www.aspfaq.com/
(Reverse address to reply.)|||You have any backups of the database or database files?
"Bryan" <bryan.charlton@.api-wi.com> wrote in message
news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> After detaching a database and deleting the logfile, I use
> sp_attach_single_file_db to attach the database and get the following
error:
> Could not open new database 'Orders'. CREATE DATABASE is aborted.
> Device activation error. The physical file name 'F:'Orders' may be
> incorrect.
> Is there any way to recover without the log file now?
>
>
>
>
>|||Also, is your Resume up to date?
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Joe" <JoeD777@.lycos.com> wrote in message
news:uZ7y3yRZEHA.3420@.TK2MSFTNGP12.phx.gbl...
> You have any backups of the database or database files?
>
> "Bryan" <bryan.charlton@.api-wi.com> wrote in message
> news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> error:
>|||Yes, I have a backup that I can restore from. This is my only option I take
it?
"Joe" <JoeD777@.lycos.com> wrote in message
news:uZ7y3yRZEHA.3420@.TK2MSFTNGP12.phx.gbl...
> You have any backups of the database or database files?
>
> "Bryan" <bryan.charlton@.api-wi.com> wrote in message
> news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> error:
>|||I have actually done this more times than I can count when moving
development databases from server to server and have never had a problem
(until now).
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OQl33yRZEHA.716@.TK2MSFTNGP11.phx.gbl...
> Can I ask why you would ever do this?
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>|||> I have actually done this more times than I can count
Move the data and the log file. Or, backup and restore. What you're doing
is quite similar roulette, and you've merely been on a lucky roll until this
spin.
http://www.aspfaq.com/
(Reverse address to reply.)|||> Yes, I have a backup that I can restore from. This is my only option I
take
> it?
Or, you can call PSS.|||Isn't it possible that the physical file name really is incorrect, as the
error says? Are you sure it isn't 'F:'Orders.mdf' instead of 'F:'Orders'?
You don't need the log file to attach the DB.
-John Oakes
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:Omp91KSZEHA.1048@.tk2msftngp13.phx.gbl...
> Move the data and the log file. Or, backup and restore. What you're
doing
> is quite similar roulette, and you've merely been on a lucky roll until
this
> spin.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>|||theoretically he should have been alright
Inside SQL 2000 "One benefit of using the sp_detach_db procedure is that SQL
Server will know that the database was cleanly shut down, and the log file
does not have to be available to attach the database. SQL will build a new
log file for you. This can be a quick way to shrink a log file that has
become much larger than you would like, because the new log file that
sp_attach_db creates for you will be the minimum sizeless than 1 MB. Note
that this trick for shrinking the log will not work if the database has more
than one log file."
But you're right he should have been a bit more careful on a production
server. P45 time!
Br,
Mark Broadbent
mcdba , mcse+i
=============
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:Omp91KSZEHA.1048@.tk2msftngp13.phx.gbl...
> Move the data and the log file. Or, backup and restore. What you're
doing
> is quite similar roulette, and you've merely been on a lucky roll until
this
> spin.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>

How bad is this??

After detaching a database and deleting the logfile, I use
sp_attach_single_file_db to attach the database and get the following error:
Could not open new database 'Orders'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'F:\'Orders' may be
incorrect.
Is there any way to recover without the log file now?> After detaching a database and deleting the logfile
Can I ask why you would ever do this?
--
http://www.aspfaq.com/
(Reverse address to reply.)|||You have any backups of the database or database files?
"Bryan" <bryan.charlton@.api-wi.com> wrote in message
news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> After detaching a database and deleting the logfile, I use
> sp_attach_single_file_db to attach the database and get the following
error:
> Could not open new database 'Orders'. CREATE DATABASE is aborted.
> Device activation error. The physical file name 'F:\'Orders' may be
> incorrect.
> Is there any way to recover without the log file now?
>
>
>
>
>|||Also, is your Resume up to date?
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Joe" <JoeD777@.lycos.com> wrote in message
news:uZ7y3yRZEHA.3420@.TK2MSFTNGP12.phx.gbl...
> You have any backups of the database or database files?
>
> "Bryan" <bryan.charlton@.api-wi.com> wrote in message
> news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> > After detaching a database and deleting the logfile, I use
> > sp_attach_single_file_db to attach the database and get the following
> error:
> >
> > Could not open new database 'Orders'. CREATE DATABASE is aborted.
> > Device activation error. The physical file name 'F:\'Orders' may be
> > incorrect.
> >
> > Is there any way to recover without the log file now?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>|||Yes, I have a backup that I can restore from. This is my only option I take
it?
"Joe" <JoeD777@.lycos.com> wrote in message
news:uZ7y3yRZEHA.3420@.TK2MSFTNGP12.phx.gbl...
> You have any backups of the database or database files?
>
> "Bryan" <bryan.charlton@.api-wi.com> wrote in message
> news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
>> After detaching a database and deleting the logfile, I use
>> sp_attach_single_file_db to attach the database and get the following
> error:
>> Could not open new database 'Orders'. CREATE DATABASE is aborted.
>> Device activation error. The physical file name 'F:\'Orders' may be
>> incorrect.
>> Is there any way to recover without the log file now?
>>
>>
>>
>>
>>
>|||I have actually done this more times than I can count when moving
development databases from server to server and have never had a problem
(until now).
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OQl33yRZEHA.716@.TK2MSFTNGP11.phx.gbl...
>> After detaching a database and deleting the logfile
> Can I ask why you would ever do this?
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>|||> I have actually done this more times than I can count
Move the data and the log file. Or, backup and restore. What you're doing
is quite similar roulette, and you've merely been on a lucky roll until this
spin.
--
http://www.aspfaq.com/
(Reverse address to reply.)|||> Yes, I have a backup that I can restore from. This is my only option I
take
> it?
Or, you can call PSS.|||Isn't it possible that the physical file name really is incorrect, as the
error says? Are you sure it isn't 'F:\'Orders.mdf' instead of 'F:\'Orders'?
You don't need the log file to attach the DB.
-John Oakes
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:Omp91KSZEHA.1048@.tk2msftngp13.phx.gbl...
> > I have actually done this more times than I can count
> Move the data and the log file. Or, backup and restore. What you're
doing
> is quite similar roulette, and you've merely been on a lucky roll until
this
> spin.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>|||theoretically he should have been alright
Inside SQL 2000 "One benefit of using the sp_detach_db procedure is that SQL
Server will know that the database was cleanly shut down, and the log file
does not have to be available to attach the database. SQL will build a new
log file for you. This can be a quick way to shrink a log file that has
become much larger than you would like, because the new log file that
sp_attach_db creates for you will be the minimum size?less than 1 MB. Note
that this trick for shrinking the log will not work if the database has more
than one log file."
But you're right he should have been a bit more careful on a production
server. P45 time!
--
Br,
Mark Broadbent
mcdba , mcse+i
============="Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:Omp91KSZEHA.1048@.tk2msftngp13.phx.gbl...
> > I have actually done this more times than I can count
> Move the data and the log file. Or, backup and restore. What you're
doing
> is quite similar roulette, and you've merely been on a lucky roll until
this
> spin.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>|||Bryan old chap try this see if you get any joy and let me know :)
http://www.spaceprogram.com/knowledge/sqlserver_recover_from_deleted_log.html
--
Br,
Mark Broadbent
mcdba , mcse+i
============="Bryan" <bryan.charlton@.api-wi.com> wrote in message
news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> After detaching a database and deleting the logfile, I use
> sp_attach_single_file_db to attach the database and get the following
error:
> Could not open new database 'Orders'. CREATE DATABASE is aborted.
> Device activation error. The physical file name 'F:\'Orders' may be
> incorrect.
> Is there any way to recover without the log file now?
>
>
>
>
>|||P45 time' Punt'
-- George Hester
__________________________________
"Mark Broadbent" <no-spam-please@.no-spam-please.com> wrote in message =news:etZkUVTZEHA.3304@.TK2MSFTNGP09.phx.gbl...
> theoretically he should have been alright
> Inside SQL 2000 "One benefit of using the sp_detach_db procedure is =that SQL
> Server will know that the database was cleanly shut down, and the log =file
> does not have to be available to attach the database. SQL will build a =new
> log file for you. This can be a quick way to shrink a log file that =has
> become much larger than you would like, because the new log file that
> sp_attach_db creates for you will be the minimum size-less than 1 MB. =Note
> that this trick for shrinking the log will not work if the database =has more
> than one log file."
> > But you're right he should have been a bit more careful on a =production
> server. P45 time!
> > -- > > > Br,
> Mark Broadbent
> mcdba , mcse+i
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:Omp91KSZEHA.1048@.tk2msftngp13.phx.gbl...
> > > I have actually done this more times than I can count
> >
> > Move the data and the log file. Or, backup and restore. What =you're
> doing
> > is quite similar roulette, and you've merely been on a lucky roll =until
> this
> > spin.
> >
> > -- > > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >|||Are you sure you are providing the proper data file name?
F:\Orders ? with no extension...
If the filename or directory is inaccurate you will get the same message you
are now seeing.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Bryan" <bryan.charlton@.api-wi.com> wrote in message
news:%23IVTepRZEHA.3016@.tk2msftngp13.phx.gbl...
> After detaching a database and deleting the logfile, I use
> sp_attach_single_file_db to attach the database and get the following
error:
> Could not open new database 'Orders'. CREATE DATABASE is aborted.
> Device activation error. The physical file name 'F:\'Orders' may be
> incorrect.
> Is there any way to recover without the log file now?
>
>
>
>
>|||"P45 time" is a common UK expression meaning it is time to get a new job.
P45 is the number on the standard UK form that states your tax details that
an emploer is obliged to give you when you leave their employment!
Mike John
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:uxQ2fhUZEHA.3432@.TK2MSFTNGP10.phx.gbl...
P45 time' Punt'
--
George Hester
__________________________________
"Mark Broadbent" <no-spam-please@.no-spam-please.com> wrote in message
news:etZkUVTZEHA.3304@.TK2MSFTNGP09.phx.gbl...
> theoretically he should have been alright
> Inside SQL 2000 "One benefit of using the sp_detach_db procedure is that
SQL
> Server will know that the database was cleanly shut down, and the log file
> does not have to be available to attach the database. SQL will build a new
> log file for you. This can be a quick way to shrink a log file that has
> become much larger than you would like, because the new log file that
> sp_attach_db creates for you will be the minimum size-less than 1 MB. Note
> that this trick for shrinking the log will not work if the database has
more
> than one log file."
> But you're right he should have been a bit more careful on a production
> server. P45 time!
> --
>
> Br,
> Mark Broadbent
> mcdba , mcse+i
> =============> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:Omp91KSZEHA.1048@.tk2msftngp13.phx.gbl...
> > > I have actually done this more times than I can count
> >
> > Move the data and the log file. Or, backup and restore. What you're
> doing
> > is quite similar roulette, and you've merely been on a lucky roll until
> this
> > spin.
> >
> > --
> > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
>