Showing posts with label included. Show all posts
Showing posts with label included. Show all posts

Sunday, March 11, 2012

Database attach at setup

Hello,

Our product has a MDF file included with the setup, this needs to be attached at the current SQL Server (Express or not).
Where can we copy the MDF file during setup so it can be attached successfully ? Smile We need a place where the account SQL Server is running under has write permissions.

Please help !
Thanks

You can always use CREATE DATABASE mydb ON ( FILENAME = 'mydb.mdf')
to attach a database after installing sql server.

refer to http://msdn2.microsoft.com/en-us/library/aa258257(SQL.80).aspx for more details.

or you can do attach database via management studio

Look into this link: http://msdn2.microsoft.com/en-us/library/ms190209.aspx

|||

Embedded database feature is only available in SQL Server Express. In express, in connection string you can mention UserInstance and attach mdf file. But in all other versions, you will have to attach the database using some sqlscript explicitly. And also connection string will differ in both method

Refer this link for userinstance :

http://blogs.msdn.com/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx

Madhu

Friday, February 24, 2012

Data Using DTS

Hi I have a query and when I run it in SQL query analyzer and select "results to file option I get the nice header of the column in included in the file that it generates. My problem is when I want to do this in a DTS job, the header does not align as nicely. For example see below...
Query run in Query analyzer and select results in file option I get this header...
Employee ID Social Security Number Birth Date
---------------
111111111 123456789 01/01/2000
(not how it is aligned)...
Result from DTS...
"Employee ID","Social Security Number","Birth Date"
"111111111","123456789","01/01/2000"
How can I output as the query analyzer using DTS?
Thanks.

In the Export Data wizard, change the "Delimited" option to "Fixed Width".