Problem With Creating Database With .mdf File
Aug 24, 2001
i got a mdf file from one sql server and am trying to create an identical database with this file. i've done it many times before, but for some reason it isnt working. here's the problem:
Server: Msg 945, Level 14, State 2, Line 1
Database 'isp' cannot be opened because some of the files could not be activated.
Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'isp'. CREATE DATABASE is aborted.
View 1 Replies
ADVERTISEMENT
Oct 12, 2005
how can i create a new database with a .mdf file ? in mS SQL 2000
thank you
View 1 Replies
View Related
Feb 24, 2008
Hi all, I'm new to sql server ce and would like to know how can I create the sdf file?
Is it the sdf file have to be published from sql server 2005? Are there any other ways to do? Coz I planned to write a win32 application to create the sdf file then deploy it the mobile device, but I found I cannot add the System.Data.SqlServerCe reference into the win form in Visual Studio.
Thx a million~
View 22 Replies
View Related
Mar 24, 2015
How to estimate the size of datafile while creating the database?
View 2 Replies
View Related
Sep 2, 2007
Greetings, I have just arrived back into the country (NZ) and back into ASP.NET.
I am having trouble with the following:An attempt to attach an auto-named database for file (file location).../Database.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
It has only begun since i decided i wanted to use IIS, I realise VWD comes with its own localhost, but since it is only temporary, i wanted a permanent shortcut on my desktop to link to my intranet page.
Anyone have any ideas why i am getting the above error? have searched many places on the internet and not getting any closer.
Cheers ~ J
View 3 Replies
View Related
Jul 6, 2015
For a database, we have 4 data files in a particular file group and the file sizes are almost 70 GB each.
Do I come across any performance issues if I create/pre-allocate an additional data file in the same file group so that the existing files don't grow too much?
View 5 Replies
View Related
Oct 9, 2007
yes,I have an error, like 'The database file may be corrupted. Run the repair utility to check the database file. [ Database name = SDMMC Storage Cardwinpos_2005WINPOS2005.sdf ]' .I develope a program for Pocket Pcs and this program's database sometimes corrupt.what can i do?please help me
View 4 Replies
View Related
Mar 2, 2014
I am trying to create an ssis package with dynamic csv file as output. and out format contains query output.
sample file name:
Unique identifier + query output + systemdate();
The expression is looking like this.
@[User::FilePath] + @[User::FileName] + ".CSV"
-- user filepath is a variable from ssis package. File name is the output from SQL query. using script task i have assigned the values to @[User::FileName] .
When I debugged the script task the value getting properly but same variable am using for Flafile destination. but its not working.
View 3 Replies
View Related
Mar 24, 2006
I know allot of folks are having this problem and I tried lots of things but nothing works. I understand the problem is coping the SQL Express on another server is the problem - I just not sure what to do?
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
This is the last statement on the Stack Trace:
SqlException (0x80131904): An attempt to attach an auto-named database for file e:wwwdata81d0493fwwwApp_DataTestDatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735091
I checked my server forum and they said I had to name a database:
Example: Database=(unique name);
But this didn't work either.
I just tried a simple web project that has only one database and one table in SQL Express with one sqldatasource and one datagrid. It works fine on my pc but when I use the copy function in Visio Studio 2005 Pro - I can't run the site on the remote server: www.myjewelrydirect.com
I tried coping the database manually. I tried disconnecting the database before I copy it. Below is my connection statement:
<connectionStrings>
<add name="TestDB" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|TestDatabase.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
With all the comments in these forums - this must be a bug.
I have been working on this problem for over 2 weeks - HELP!
View 1 Replies
View Related
Jul 14, 2007
Can anybody run me through the process to create a CSV file from an SQLexpress database using BCP.exe ?
Or is there a simpler way to create a CSV for that matter?
Really important and would be much appreciated.
View 1 Replies
View Related
Oct 26, 1998
Hi,
If anyone knows ,please tell how to store all fields with comma seperation by select statement into a text file, without using Extended Stored Procedure.
Thanks in advance.
View 4 Replies
View Related
May 22, 2007
I have a system which has several different dbases involved, and have created an update procedure within it all. It all works fine, but as a refrenence point I want to create a log file,each time the procedure is run.
This file will have useful info such as no of transactions added, no of product row n customer rows, any unmatching entries and any exception records. What I dont know is how do I create such a file?
I was thinking maybe I could save the info into a table, and then somehow transfer this into a txt file? The txt file will be replaced each time the stored procedure is run.... Does any1 know any links or ideas that might help me?...I never does anything lik this b4 but I have seen it done.....
Thanks in advance!
View 11 Replies
View Related
Jun 28, 2006
Hi All!
I am still trying to understand all the differences between SQL 2000 and 2005. This question probably has a really easy answer, but I just don't know it. I need to create a DTS routine that creates a file from a table. The catch is, it needs to have a header segment, data segment, and footer segment. In SQL 2000, I would have created activex script to create this file. Since SQL 2005 is going away from activex script I am at a loss.
The file will be in this format.
Header
Data
Data
Data
Data
Data
Data
Footer
Basically output header from table... loop through table for data... and output footer from table.
If anyone knows how to do this, I would appreciate the help.
Thanks.
Danielle
View 5 Replies
View Related
Sep 8, 2007
Hi,
We are using VS 2005 with SQL Server Mobile Edition. We created the .sdf file on the desktop and added this file to our VS project and set the Build Action to content. Next we deployed our app on Symbol PDA which has Windows CE 5.0 as the OS. We followed the following steps:
1. Deploy the app.
2. Install .NET CF 2.0
3. System_SR_ENU.CAB
4. sqlce30.wce5.armv4i.CAB
5. sqlce30.dev.ENU.wce5.armv4i.CAB
6. sqlce30.repl.wce5.armv4i.CAB
Now I want to create a new .sdf file in PDA. So I open QA3.0 and type the create database command. But I get error:
You need to have a database connection opened in order to run this operation.
What could be the issue?
Regards,
Vilas
View 1 Replies
View Related
Jun 11, 2008
Hi can I know how to create a dbml file for northwind database. Please note I am using sqlserver 2008
View 4 Replies
View Related
Nov 4, 2003
Hi, I wrote a report builder that creates a CSV file but I can't redirect to the file to view it. ERROR Cannot find the Server!. This works fine on the dev machine but deploy it and it does not.
Dim Conn As New SqlConnection(ConfigurationSettings.AppSettings("ConStr"))
Dim Cm As SqlCommand
Dim dr As SqlDataReader
Dim FileName As String = Guid.NewGuid.ToString & ".csv"
Dim FilePath As String = Server.MapPath("") & "CSVFiles" & FileName
Dim fs As FileStream = New FileStream(FilePath, FileMode.Create, FileAccess.Write)
Dim sw As StreamWriter = New StreamWriter(fs)
Dim Line As String
Dim lItem As System.Xml.XmlElement
Dim i As Int16
If ValidatePage() Then
Cm = New SqlCommand(BuildQuery, Conn)
Conn.Open()
dr = Cm.ExecuteReader()
Dim lXmlDoc As New System.Xml.XmlDocument()
lXmlDoc.LoadXml(txtHXml.InnerText)
For Each lItem In lXmlDoc.DocumentElement.SelectSingleNode("SELECT").ChildNodes
Select Case lItem.InnerText
Case "chkPRId"
Line &= "PR Id,"
Case "chkDateIssued"
Line &= "Date Issued,"
Case "chkOriginator"
Line &= "Originator,"
Case "chkBuyer"
Line &= "Buyer,"
Case "chkVendor"
Line &= "Vendor,"
Case "chkCostCode"
Line &= "Cost Code,"
Case "chkOracleRef"
Line &= "Oracle Reference,"
Case "chkTotal"
Line &= "Total,"
End Select
Next
Line = Line.Substring(0, Line.Length - 1)
sw.WriteLine(Line)
Line = ""
While dr.Read
For i = 0 To dr.FieldCount - 1
Line = Line & dr(i) & ","
Next
sw.WriteLine(Line)
Line = ""
End While
dr.Close()
Conn.Close()
sw.Close()
fs.Close()
Response.Redirect(FilePath)
End If
ResetPage()
PopulateListBoxFromXML()
View 1 Replies
View Related
Apr 23, 2001
how do you create a database from an .mdf file?
View 2 Replies
View Related
Dec 19, 2000
Hi,
How can we create a new D/B from a D/B Backup file (DataBase.Bak).
Thanks,
Princy
View 3 Replies
View Related
Oct 16, 2000
Hi,
I am new to SqlServer (I am using 7.0) and I have just recieved a database.bak file from one of our clients and I want to create a new D/B from this back up file ,I have already installed the MS SqlServer. Can you tell me how to do this.
Thanks,
Princy
View 1 Replies
View Related
May 17, 2003
I am using this bcp out construct and it works fine except that if the query does not return values it bcp's out a file anyhow. This is not wanted and I am looking for a work around.
SELECT @Year = CONVERT(varchar(4), @trxYearMonthStart, 120)
SELECT @Month = RIGHT(CONVERT(varchar(7), @trxYearMonthStart, 120),2)
SELECT @cmd = 'BCP "SELECT * FROM ' + @TableToBeCleaned + ''
SELECT @cmd = @cmd + ' WHERE '+ @SelectedColumn + ' BETWEEN '
print @cmd
SELECT @cmd = @cmd + '''' + CONVERT(varchar(10),@trxYearMonthStart,120) + ''' and ''' + CONVERT(varchar(10),@trxYearMonthEnd,120) + ''''
print @cmd
SELECT @cmd = @cmd + 'AND NOT EXISTS (Select * from DBCleanerHist Where TableName = ''' + @TableToBeCleaned + ''' and sYear = '+ @Year + ' and sMonth = ' + @Month + ')'
print @cmd
SELECT @cmd = @cmd + ' " QUERYOUT ' + @DBCleanerBackUpPath+'' +@TableToBeCleaned +'_'+ @Year + '_' + @Month + '.txt '
SELECT @cmd = @cmd + ' -c -C1250 -S -Uopms -Psmpo'
EXEC master.dbo.xp_cmdshell @cmd
The subquery checks first in DBCleanerHist if a file already has been extracted onto hd and if so do not create an empty file and overwrite an existing file.
thanks
mipo
View 1 Replies
View Related
Jul 7, 2004
Bit of a SQL newbie, having taken over a support role for a piece of software that my firm sells. It is basically a DB that runs on MSDE or SQL Server in either desktop or enterprise scenarios.
We do sell our software to clients who may or may not already have SQL on their machines. During installation, it searches for sqlservr.exe for existing SQL installations and if it finds nothing, will then install MSDE 1.0 to house the db files.
My question is this -
I can manually create a db or manually attach an existing db through sql query analyser where there is a full-blown SQL installation. Is there any way I can do the same where there is only MSDE installed? The simple solution, I guess, would be to download one of the freeware or shareware MSDE "Enterprise Managers", but this won't always be suitable for a client installation.
Many thanks for your assistance all.
:cool:
View 3 Replies
View Related
Sep 26, 2006
I am trying to read a SP.sql file where i want to write all the procedures to create them in the database
CREATE PROCEDURE SP_1
AS
BEGIN
DELETE FROM tb1
END
CREATE PROCEDURE SP_2
AS
BEGIN
DELETE FROM tb2
END
if there is only one procedure in the file it works, with > 1 procedure it fails
inserting GO between doesnt work
how is it possible to run a sql file with many stored procedures in it from a server langages ?
thank you
View 8 Replies
View Related
Mar 30, 2004
hi,
I am trying to create a file using a query in SQL...
kindly help.
Thankyou. --- Vijay
View 8 Replies
View Related
Jun 13, 2008
Hi All, I need to create a batch file to execute some 5-6 sql scripts. I have sql scripts for creating a table and related storedprocs and I need to generate a batch file to run all this scripts.
View 3 Replies
View Related
Oct 3, 2007
I have AdventureWorks installed. I am using SQL Server 2005.
I need to import some large tab delimited text files into SQL. From the research i did I thought that using BCO would be the best solution becausr I will have to import these files and export in the same format.
I am attempting to follow the example at:
Creating a Format File
http://msdn2.microsoft.com/en-us/library/ms191516.aspx
B. Creating a non-XML format file for character data
In my command window at C: I enter:
bcp AdventureWorks.HumanResources.Department format nul -c -f Department-c.fmt -T
I was expecting to be prompted with questions about the source file and have a format file created. When i press enter nothing hallende. No errors. Nothing.
Can come one give a beginner the step by step on how to creat the format file and use it to import (and export would be nice too).
View 2 Replies
View Related
Jan 13, 2006
Hi there,
I got a user who is requesting a weekly report to be exported in csv (comma delimited) format. But this process will run weekly using schedule job and he wants the file to save to a certain directory on the network. Two part questions...
1. Is there a way to create a .csv file programmatically after runing the query?
2. How would I save the .csv file to a specified directory on the network?
TIA
View 3 Replies
View Related
Apr 29, 2008
I want to create a file at Runtime.
File Name : \directorydirectorydirectoryabc.extension (The file has to be created in a specific path only.)
The following would be the contents.
Open 123.123.123.12
cd 'directoryname'
lcd \directorydirectorydirectorydirectory
mget *.extension
bye
The file has to be created only at runtime. How can I do this.
Thanks in advance for the help.
View 3 Replies
View Related
Feb 29, 2008
Hi All,
We have a fairly standard process whereby we get a trigger file from a client FTP site, and check whether it's blank (zero length) or not. if it's not zero length, then we attempt to download the actual data file. if that's successfull, we overwrite the trigger file with a blank file.
now this is all very easy in a batch script or unix shell script, but there appears to be no "create file" option in the file system task. I've also tried having a flat file destination in a data flow task but it insists that it wants columns to be fed to it.
how can I create a blank file?!?!?
Andrew.
View 1 Replies
View Related
Aug 16, 2007
Here is my code
ALTER PROCEDURE Test
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @From varchar(10)
DECLARE @To varchar(10)
DECLARE @DBName varchar
SELECT TOP 1 @From = CONVERT(char,CreateDate,101) FROM CustomerInfo
WHERE TicketNum =
(SELECT TOP 1 TicketNum FROM CustomerInfo
WHERE CreateDate <= DATEADD(mm, -30, CURRENT_TIMESTAMP)
ORDER BY CreateDate DESC)
SELECT @To = CONVERT(char,GETDATE(),101)
SET @DBName = 'Archive_SafeHelp'
CREATE DATABASE @DBName + ' ' + @From + ' ' + @To
END
I am trying to create a database based on the name contained in the variables. I get the error 'Incorrect syntax near '@DBName'. How do i accomplish this?
Thanks
Ganesh
View 2 Replies
View Related
Mar 23, 2008
Is there a way I can use one SQL server 2005 (full edition not express) Stored procedure that can execute a .SQL file as if it were in the SQL management studio Query window?
I have the situation where I have some .SQL file which were created with the 'Create to File' option in SQL Management studio. I then want to send them to a user who can execute them to create a SP on his SQL server without having to run the SQL management tools.
Regards
Clive
View 8 Replies
View Related
Feb 13, 2006
Hi
Some one Please guide me... How to create a Excel File Dynamically in DTS.
Once i run my DTS Package the result should be moved to a new Excel sheet( This should be created dynamically).
I tries in this way but it says....Syntax error at the DTS GlobalVariables.....
Function Main()
Dim appExcel
Dim newBook
Dim oSheet
dim oPackage
dim oConn
Set appExcel = CreateObject("Excel.Application")
Set newBook = appExcel.Workbooks.Add
Set oSheet = newBook.Worksheets(1)
oSheet.Range("A1").Value = "au_lname"
oSheet.Range("B1").Value = "au_fname"
oSheet.Range("C1").Value = "phone"
oSheet.Range("D1").Value = "address"
oSheet.Range("E1").Value = "city"
DTSGlobalVariables("fileName").Value = "C:\" & Month(Now) & "-" &
Day(Now) & "-" & Year(Now) & "-" & Hour(Time) & "-" &Minute(Time) & "-" &
Second(Time) & ".xls"
With newBook
.SaveAs DTSGlobalVariables("fileName").Value
.save
End With
appExcel.quit
set oPackage = DTSGlobalVariables.parent
set oConn = oPackage.connections(2)
oConn.datasource = DTSGlobalVariables("fileName").Value
set oPackage = nothing
set oConn = nothing
Main = DTSTaskExecResult_Success
End Function
View 2 Replies
View Related
Oct 20, 2004
Hi,
I have a created a DTS packges which is reading data from sql server table, manipulate this data as required and then create a text file with that data. I created the text file using FileSystemObject. I was writing one field at a time to the text file.
I need to same thing but instead of creating text file, I need to create a excel file with each column from database going to separate column in excel sheet. I tried to do this with FileSystemObject, but it was wrting all the columns from database to one cell in excel sheet. How can I fix this problem?
Thanks!
View 8 Replies
View Related
Jul 6, 2006
sql2k sp4
Howdy all. I havent used format files inside BCP in several years and am having trouble creating one now.
declare @exec varchar(1026)
set @exec = 'bcp faa_ivr.dbo.primary_informant format -SboxNameinstanceName -c -T -f\destinationFAAIVRprimary_informant_format.txt '
exec master..xp_cmdshell @exec
output
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQLState = 08001, NativeError = 17
Error = [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or access denied.
SQLState = 01000, NativeError = 2
Warning = [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (Connect()).
NULL
(5 row(s) affected)
I've tried brackets ([])around the box/ instance name. I've tried using the FQDN. I tried the SA account instead of WINNT authentication. All ideas are appreciated.
View 4 Replies
View Related