I am using the MSDE deployment toolkit along with the
sample programs provided by Mario S. Almost everything is
fine when I want to create a database, add tables, and
etc. but I am unable to attach a database.
On one instance called "george" i have created a database
called "lawncare" and moved it to the C: drive. I am using
the same embedded resource file "DBInstall.sql" that is
used in the examples (and which works for creating tables,
etc) but I receive the following error message:
"An exception occured in the ONAfterInstall event handler
of DBInstaller.CustomInstaller.
>Line 2: Incorrect systax near 'go'
Line 4: Incorrect syntax near 'go'"
The script I am using in the resource file is:
set nocount off
go
exec sp_attach_single_file_db @.dbname = 'lawncare',
@.physname = 'c:\lawncare_Data.mdf'
go
If, in the same resource file I were to use this script:
CREATE TABLE [dbo].[City] (
[CityId] [int] IDENTITY (0, 1) NOT NULL ,
[Description] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
The table would be created just fine...(the routine
substitutes ";" for "go" when reading the text to execute.)
Any help would be appreciated.
Thanks
NJ
NJ,
Your sql is working fine, I tried it and it worked. But make sure that this database that you are trying to attach is actually detached from somewhere before. The sp_attach_single_file_db works with databases which are detached from somewhere. Also mak
e sure that your log file is at c:\ drive too .
let me know if it doesn't work.
dev
Sunday, March 25, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment