Database File... Or On Server

Jun 6, 2007

So with SQL server... I have have a file in my app_code or I can have the database directly on the server.
I don't really understand the difference or the benifits/disadvantages or each.

Could somebody quickly explain?

Dougal
 

View 4 Replies


ADVERTISEMENT

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.

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

The Database File May Be Corrupted. Run The Repair Utility To Check The Database File. [ Database Name = SDMMC Storage Cardwinp

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

How To Convert SLQ Server Express Database File To SQL Compact Edition File?

May 29, 2007

Hi all,



I have a database name MyDatabase (SQL Server Express Dabase File). Is there anyway that I could convert it to SQL Server Compact Edition File?



By the way does anyone here got any problem with programming in SQL Server Compact Edition? It troubles me.



Thanks,

bombie

View 6 Replies View Related

Converting Mdb (Access File) File To A SQL Server Database

May 14, 2008



hello,

I'm not really sure my question belongs to here...

I have a database in Access (from microsoft office, of course), and I want to transfer convert it to SQL Server.
Does anyone know how I can do it? It must be very simple, but I haven't found it yet....

Thanks a lot!

- Miri

View 7 Replies View Related

SQL Server 2008 :: How To Update The Database Physical File Location In Master Database

Mar 8, 2015

I had to to relocate the database log file and I issued an Alter database command but by mistake I put a space in the file name as below. The space is at the beginning file name. Now I am unable get the database loaded to SQL Server. The database has 2 replications configured, so deleting and re-attaching the database means the replication needs to be re-configured. Is there an alternative way to issue a command to update the database FILENAME ? Not sure if this can be edited in master database (sys files).

ALTER DATABASE [User_DB]
MODIFY FILE (NAME = User_DB_log, FILENAME = 'I:SQLLogs User_DB_log.ldf')
GO

View 1 Replies View Related

Transfer Data From A Foxpro Database File To Sql Server Database

Jun 11, 1999

i have a old database in foxpro and it has to be converted to sql server 6.5 database . the table in the foxpro has been broken into more than 1 tables in the sql server . so how can i transfer the data from 1 foxpro table to different tables in sql server 6.5.
vineet

View 1 Replies View Related

An Attempt To Attach An Auto-named Database For File...failed. A Database With The Same Name Exists, Or Specified File Cannot Be

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

Microsoft SQL Server 2005 Management Studio - Opening SQL-File From Explorer Does Not Connect Automaticly To Server/database

Apr 25, 2008

hello,

I have a question about opening files in the Microsoft SQL Server 2005 Management Studio.

In the old Query Analyzer from SQL 2000 I can open SQL Files via drag & drop (from explorer to QA) or open it with a double click in the explorer. Then the Files opened, if I had actual a connection to a server / database (QA is stared with one file and has a connection to Server/Datebase), with this connection.

Now in Microsoft SQL Server 2005 Management Studio I'll be asked everytime for Server and have to get the database from the database list - it does not connect automaticly to server/database, that is actual connected (I have opened a file with the connection and a connected database in the object explorer).

Someone do not have this problem - but we found no option to set it up.

Any ideas?

thanks &
best regards,
Christian Kiedels

View 9 Replies View Related

SQL Server &#34;.dat&#34; Database File

Jan 21, 1999

Hi,
I have a SQL Server6.5 sample database ".dat" file which I got it on a CD when I bought a VB/SQL Server Book recently.

My question is how do I get to open this database from my SQL Server6.5 Enterprise Manager.

Thanks in Advance.
Ramana

View 1 Replies View Related

Sql Server 2000 To Mdf Database File

Apr 11, 2007

I know I know this is kind of reverse thing I am asking.but as I am working on project and it is very time consuming to connect every time I want to for modifying database or dataset. 

View 1 Replies View Related

Save File Into The Sql Server Database

Feb 28, 2008

Hi,
I want to upload a file (e.g. .xls, .pdf, .doc) and save into the Sql Server 2000 database through the web interface, and then to download this file. Any idea???

View 2 Replies View Related

Storing A XML File In A SQL Server Database

Jun 23, 2004

I have records with 50 plus fields of data.I was thinking of writing all the fields data into a XML file and then store it in a SQL server database for retrieval later on.Is there anyway i can go about doing this?

View 6 Replies View Related

The .mdb Database File Must Reside On The Server

May 19, 2000

I read in MSDN that

"The .mdb database file must reside on the server. data_source is evaluated on the server, not the client, and the path must be valid on the server."

What does the above means..... I do have to have MDB file reside on server ?

If reside on server where the MDB file should go & HOW ?

In the dirctory of //mysql/binn ?, wondering how

Regards

View 1 Replies View Related

Get Server Database File Information

Sep 7, 2007

This script gets the file information for every database on a server, and inserts it into temp table #DB_INFO. #DB_INFO is queried multiple ways to give various levels of analysis of file space usage.

This script was tested on SQL Server 7.0, 2000, and 2005.


Edit 2007/9/7: Added FILEGROUP_TYPE and DISK columns.

Edit 2007/9/17: Modified to add various ways to analyze the output and format it to make it easier to understand space usage on the server:
Show Files Details
Total by Database and File
Total by Database and Filegroup
Total by Database and Filegroup Type
Total by Disk, Database, and Filepath
Total by Disk and Database
Total by Database

Edit 2007/9/17: Modified to make the changes suggested by eyechart. I managed to defeat Snitz to get rid of the smiley face () and still have executable code by putting in some extra quotes around the database name.





use master
go
if exists ( select * from tempdb.dbo.sysobjects o
where o.xtype in ('U') and o.id = object_id( N'tempdb..#DB_FILE_INFO' ))
drop table #DB_FILE_INFO
go

if exists ( select * from tempdb.dbo.sysobjects o
where o.xtype in ('U') and o.id = object_id( N'tempdb..#DB_INFO' ))
drop table #DB_INFO
go
set nocount on
go
create table #DB_FILE_INFO (
[ID]intnot null
identity (1, 1) primary key clustered ,
[DATABASE_NAME]sysnamenot null ,
[FILEGROUP_TYPE]nvarchar(4)not null ,
[FILEGROUP_ID]smallintnot null ,
[FILEGROUP]sysnamenot null ,
[FILEID]smallintnot null ,
[FILENAME]sysnamenot null ,
[DISK]nvarchar(1)not null ,
[FILEPATH]nvarchar(260)not null ,
[MAX_FILE_SIZE]intnull ,
[FILE_SIZE]intnot null ,
[FILE_SIZE_USED]intnot null ,
[FILE_SIZE_UNUSED]intnot null ,
[DATA_SIZE]intnot null ,
[DATA_SIZE_USED]intnot null ,
[DATA_SIZE_UNUSED]intnot null ,
[LOG_SIZE]intnot null ,
[LOG_SIZE_USED]intnot null ,
[LOG_SIZE_UNUSED]intnot null ,
)
go

declare @sqlnvarchar(4000)
set @sql =
'use ['+'?'+'] ;
if db_name() <> N''?'' goto Error_Exit

insert into #DB_FILE_INFO
(
[DATABASE_NAME],
[FILEGROUP_TYPE],
[FILEGROUP_ID],
[FILEGROUP],
[FILEID],
[FILENAME],
[DISK],
[FILEPATH],
[MAX_FILE_SIZE],
[FILE_SIZE],
[FILE_SIZE_USED],
[FILE_SIZE_UNUSED],
[DATA_SIZE],
[DATA_SIZE_USED],
[DATA_SIZE_UNUSED],
[LOG_SIZE],
[LOG_SIZE_USED],
[LOG_SIZE_UNUSED]
)
selecttop 100 percent
[DATABASE_NAME] = db_name(),
[FILEGROUP_TYPE]= case when a.groupid = 0 then ''Log'' else ''Data'' end,
[FILEGROUP_ID]= a.groupid,
a.[FILEGROUP],
[FILEID]= a.fileid,
[FILENAME]= a.name,
[DISK]= upper(substring(a.filename,1,1)),
[FILEPATH]= a.filename,
[MAX_FILE_SIZE] =
convert(int,round(
(case a.maxsize when -1 then null else a.maxsize end*1.000)/128.000
,0)),
[FILE_SIZE]= a.[fl_size],
[FILE_SIZE_USED] = a.[fl_used],
[FILE_SIZE_UNUSED] = a.[fl_unused],
[DATA_SIZE]= case when a.groupid <> 0 then a.[fl_size] else 0 end,
[DATA_SIZE_USED]= case when a.groupid <> 0 then a.[fl_used] else 0 end,
[DATA_SIZE_UNUSED] = case when a.groupid <> 0 then a.[fl_unused] else 0 end,
[LOG_SIZE] = case when a.groupid = 0 then a.[fl_size] else 0 end,
[LOG_SIZE_USED] = case when a.groupid = 0 then a.[fl_used] else 0 end,
[LOG_SIZE_UNUSED] = case when a.groupid = 0 then a.[fl_unused] else 0 end
from
(
Select
aa.*,
[FILEGROUP]= isnull(bb.groupname,''''),
-- All sizes are calculated in MB
[fl_size]=
convert(int,round((aa.size*1.000)/128.000,0)),
[fl_used]=
convert(int,round(fileproperty(aa.name,''SpaceUsed'')/128.000,0)),
[fl_unused]=
convert(int,round((aa.size-fileproperty(aa.name,''SpaceUsed''))/128.000,0))
from
dbo.sysfiles aa
left join
dbo.sysfilegroups bb
on ( aa.groupid = bb.groupid )
) a
order by
case when a.groupid = 0 then 0 else 1 end,
a.[FILEGROUP],
a.name

Error_Exit:

'

--print @sql

exec sp_msforeachdb @sql

--select * from #DB_FILE_INFO

declare @DATABASE_NAME_LENvarchar(20)
declare @FILEGROUP_LENvarchar(20)
declare @FILENAME_LENvarchar(20)
declare @FILEPATH_LENvarchar(20)

select
@DATABASE_NAME_LEN= convert(varchar(20),max(len(rtrim(DATABASE_NAME)))),
@FILEGROUP_LEN= convert(varchar(20),max(len(rtrim(FILEGROUP)))),
@FILENAME_LEN= convert(varchar(20),max(len(rtrim(FILENAME)))),
@FILEPATH_LEN= convert(varchar(20),max(len(rtrim(FILEPATH))))
from
#DB_FILE_INFO

if object_id('tempdb..##DB_Size_Info_D115CA380E2B4538B6CBBB51') is not null
begin
drop table ##DB_Size_Info_D115CA380E2B4538B6CBBB51
end

-- Setup code to reduce column sizes to max used
set @sql =
'
select
[DATABASE_NAME]= convert(varchar('+@DATABASE_NAME_LEN+'), a.[DATABASE_NAME] ),
a.[FILEGROUP_TYPE],
[FILEGROUP_ID],
[FILEGROUP]= convert(varchar('+@FILEGROUP_LEN+'), a.[FILEGROUP]),
[FILEID],
[FILENAME]= convert(varchar('+@FILENAME_LEN+'), a.[FILENAME] ),
a.[DISK],
[FILEPATH]= convert(varchar('+@FILEPATH_LEN+'), a.[FILEPATH] ),
a.[MAX_FILE_SIZE],
a.[FILE_SIZE],
a.[FILE_SIZE_USED],
a.[FILE_SIZE_UNUSED],
FILE_USED_PCT=
convert(numeric(5,1),round(
case
when a.[FILE_SIZE] is null or a.[FILE_SIZE] = 0
then NULL
else (100.00000*a.[FILE_SIZE_USED])/(1.00000*a.[FILE_SIZE])
end ,1)) ,
a.[DATA_SIZE],
a.[DATA_SIZE_USED],
a.[DATA_SIZE_UNUSED],
a.[LOG_SIZE],
a.[LOG_SIZE_USED],
a.[LOG_SIZE_UNUSED]
into
##DB_Size_Info_D115CA380E2B4538B6CBBB51
from
#DB_FILE_INFO a
order by
a.[DATABASE_NAME],
case a.[FILEGROUP_ID] when 0 then 0 else 1 end,
a.[FILENAME]
'

--print @sql

exec ( @sql )

selecttop 100 percent
*
into
#DB_INFO
from
##DB_Size_Info_D115CA380E2B4538B6CBBB51 a
order by
a.[DATABASE_NAME],
case a.[FILEGROUP_ID] when 0 then 0 else 1 end,
a.[FILENAME]

drop table ##DB_Size_Info_D115CA380E2B4538B6CBBB51

set nocount off

print 'Show Details'
select * from #DB_INFO

print 'Total by Database and File'
select
[DATABASE_NAME]= isnull([DATABASE_NAME],' All Databases'),
[FILENAME]= isnull([FILENAME],''),
FILE_SIZE= sum(FILE_SIZE),
FILE_SIZE_USED= sum(FILE_SIZE_USED),
FILE_SIZE_UNUSED= sum(FILE_SIZE_UNUSED),
FILE_USED_PCT=
convert(numeric(5,1),round(
case
when sum(a.[FILE_SIZE]) is null or sum(a.[FILE_SIZE]) = 0
then NULL
else (100.00000*sum(a.[FILE_SIZE_USED]))/(1.00000*sum(a.[FILE_SIZE]))
end ,1)) ,
DATA_SIZE= sum(DATA_SIZE),
DATA_SIZE_USED= sum(DATA_SIZE_USED),
DATA_SIZE_UNUSED= sum(DATA_SIZE_UNUSED),
LOG_SIZE= sum(LOG_SIZE),
LOG_SIZE_USED= sum(LOG_SIZE_USED),
LOG_SIZE_UNUSED= sum(LOG_SIZE_UNUSED)
from
#DB_INFO a
group by
[DATABASE_NAME],
[FILENAME]
with rollup
order by
case when [DATABASE_NAME] is null then 1 else 0 end ,
[DATABASE_NAME],
case when [FILENAME] is null then 1 else 0 end ,
[FILENAME]


print 'Total by Database and Filegroup'

select
--[Server]= convert(varchar(15),@@servername),
[DATABASE_NAME]= isnull([DATABASE_NAME],'** Total **'),
[FILEGROUP]=
case when [FILEGROUP] is null then '' when [FILEGROUP] = '' then 'LOG' else [FILEGROUP] end,
FILE_SIZE= sum(FILE_SIZE),
FILE_SIZE_USED= sum(FILE_SIZE_USED),
FILE_SIZE_UNUSED= sum(FILE_SIZE_UNUSED),
FILE_USED_PCT=
convert(numeric(5,1),round(
case
when sum(a.[FILE_SIZE]) is null or sum(a.[FILE_SIZE]) = 0
then NULL
else (100.00000*sum(a.[FILE_SIZE_USED]))/(1.00000*sum(a.[FILE_SIZE]))
end ,1)) ,
--MAX_SIZE= SUM([MAX_FILE_SIZE]),
DATA_SIZE= sum(DATA_SIZE),
DATA_SIZE_USED= sum(DATA_SIZE_USED),
DATA_SIZE_UNUSED= sum(DATA_SIZE_UNUSED),
LOG_SIZE= sum(LOG_SIZE),
LOG_SIZE_USED= sum(LOG_SIZE_USED),
LOG_SIZE_USED= sum(LOG_SIZE_UNUSED)
from
#DB_INFO A
group by
[DATABASE_NAME],
[FILEGROUP]
with rollup
order by
case when [DATABASE_NAME] is null then 1 else 0 end ,
[DATABASE_NAME],
case when [FILEGROUP] is null then 10 when [FILEGROUP] = '' then 0 else 1 end ,
[FILEGROUP]


print 'Total by Database and Filegroup Type'

select
--[Server]= convert(varchar(15),@@servername),
[DATABASE_NAME]= isnull([DATABASE_NAME],'** Total **'),
[FILEGROUP_TYPE]= isnull([FILEGROUP_TYPE],''),
FILE_SIZE= sum(FILE_SIZE),
FILE_SIZE_USED= sum(FILE_SIZE_USED),
FILE_SIZE_UNUSED= sum(FILE_SIZE_UNUSED),
FILE_USED_PCT=
convert(numeric(5,1),round(
case
when sum(a.[FILE_SIZE]) is null or sum(a.[FILE_SIZE]) = 0
then NULL
else (100.00000*sum(a.[FILE_SIZE_USED]))/(1.00000*sum(a.[FILE_SIZE]))
end ,1)) ,
DATA_SIZE= sum(DATA_SIZE),
DATA_SIZE_USED= sum(DATA_SIZE_USED),
DATA_SIZE_UNUSED= sum(DATA_SIZE_UNUSED),
LOG_SIZE= sum(LOG_SIZE),
LOG_SIZE_USED= sum(LOG_SIZE_USED),
LOG_SIZE_USED= sum(LOG_SIZE_UNUSED)
from
#DB_INFO A
group by
[DATABASE_NAME],
[FILEGROUP_TYPE]
with rollup
order by
case when [DATABASE_NAME] is null then 1 else 0 end ,
[DATABASE_NAME],
case when [FILEGROUP_TYPE] is null then 10 when [FILEGROUP_TYPE] = 'Log' then 0 else 1 end


print 'Total by Disk, Database, and Filepath'
select
[DISK]= isnull([DISK],''),
[DATABASE_NAME]= isnull([DATABASE_NAME],''),
[FILEPATH]= isnull([FILEPATH],''),
FILE_SIZE= sum(FILE_SIZE),
FILE_SIZE_USED= sum(FILE_SIZE_USED),
FILE_SIZE_UNUSED= sum(FILE_SIZE_UNUSED),
FILE_USED_PCT=
convert(numeric(5,1),round(
case
when sum(a.[FILE_SIZE]) is null or sum(a.[FILE_SIZE]) = 0
then NULL
else (100.00000*sum(a.[FILE_SIZE_USED]))/(1.00000*sum(a.[FILE_SIZE]))
end ,1)) ,
DATA_SIZE= sum(DATA_SIZE),
DATA_SIZE_USED= sum(DATA_SIZE_USED),
DATA_SIZE_UNUSED= sum(DATA_SIZE_UNUSED),
LOG_SIZE= sum(LOG_SIZE),
LOG_SIZE_USED= sum(LOG_SIZE_USED),
LOG_SIZE_UNUSED= sum(LOG_SIZE_UNUSED)
from
#DB_INFO a
group by
[DISK],
[DATABASE_NAME],
[FILEPATH]
with rollup
order by
case when [DISK] is null then 1 else 0 end ,
[DISK],
case when [DATABASE_NAME] is null then 1 else 0 end ,
[DATABASE_NAME],
case when [FILEPATH] is null then 1 else 0 end ,
[FILEPATH]



print 'Total by Disk and Database'
select
[DISK]= isnull([DISK],''),
[DATABASE_NAME]= isnull([DATABASE_NAME],''),
FILE_SIZE= sum(FILE_SIZE),
FILE_SIZE_USED= sum(FILE_SIZE_USED),
FILE_SIZE_UNUSED= sum(FILE_SIZE_UNUSED),
FILE_USED_PCT=
convert(numeric(5,1),round(
case
when sum(a.[FILE_SIZE]) is null or sum(a.[FILE_SIZE]) = 0
then NULL
else (100.00000*sum(a.[FILE_SIZE_USED]))/(1.00000*sum(a.[FILE_SIZE]))
end ,1)) ,
DATA_SIZE= sum(DATA_SIZE),
DATA_SIZE_USED= sum(DATA_SIZE_USED),
DATA_SIZE_UNUSED= sum(DATA_SIZE_UNUSED),
LOG_SIZE= sum(LOG_SIZE),
LOG_SIZE_USED= sum(LOG_SIZE_USED),
LOG_SIZE_USED= sum(LOG_SIZE_UNUSED)
from
#DB_INFO a
group by
[DISK],
[DATABASE_NAME]
with rollup
order by
case when [DISK] is null then 1 else 0 end ,
[DISK],
case when [DATABASE_NAME] is null then 1 else 0 end ,
[DATABASE_NAME]



print 'Total by Disk'
select
[DISK]= isnull([DISK],''),
FILE_SIZE= sum(FILE_SIZE),
FILE_SIZE_USED= sum(FILE_SIZE_USED),
FILE_SIZE_UNUSED= sum(FILE_SIZE_UNUSED),
FILE_USED_PCT=
convert(numeric(5,1),round(
case
when sum(a.[FILE_SIZE]) is null or sum(a.[FILE_SIZE]) = 0
then NULL
else (100.00000*sum(a.[FILE_SIZE_USED]))/(1.00000*sum(a.[FILE_SIZE]))
end ,1)) ,
DATA_SIZE= sum(DATA_SIZE),
DATA_SIZE_USED= sum(DATA_SIZE_USED),
DATA_SIZE_UNUSED= sum(DATA_SIZE_UNUSED),
LOG_SIZE= sum(LOG_SIZE),
LOG_SIZE_USED= sum(LOG_SIZE_USED),
LOG_SIZE_USED= sum(LOG_SIZE_UNUSED)
from
#DB_INFO a
group by
[DISK]
with rollup
order by
case when [DISK] is null then 1 else 0 end ,
[DISK]


print 'Total by Database'
select
--[Server]= convert(varchar(20),@@servername),
[DATABASE_NAME]= isnull([DATABASE_NAME],'** Total **'),
FILE_SIZE= sum(FILE_SIZE),
FILE_SIZE_USED= sum(FILE_SIZE_USED),
FILE_SIZE_UNUSED= sum(FILE_SIZE_UNUSED),
FILE_USED_PCT=
convert(numeric(5,1),round(
case
when sum(a.[FILE_SIZE]) is null or sum(a.[FILE_SIZE]) = 0
then NULL
else (100.00000*sum(a.[FILE_SIZE_USED]))/(1.00000*sum(a.[FILE_SIZE]))
end ,1)) ,
DATA_SIZE= sum(DATA_SIZE),
DATA_SIZE_USED= sum(DATA_SIZE_USED),
DATA_SIZE_UNUSED= sum(DATA_SIZE_UNUSED),
LOG_SIZE= sum(LOG_SIZE),
LOG_SIZE_USED= sum(LOG_SIZE_USED),
LOG_SIZE_UNUSED= sum(LOG_SIZE_UNUSED)
from
#DB_INFO A
group by
[DATABASE_NAME]
with rollup
order by
case when [DATABASE_NAME] is null then 1 else 0 end ,
[DATABASE_NAME]





CODO ERGO SUM

View 1 Replies View Related

Copying A Sql Server Database File

Mar 12, 2008

I am developing a .NET 2.0 application that uses Sql Express as its backend.
I use OleDb Provider to connect to Sql express.

One of the options in the app allows the Admin to create a Backup of the database. As part of this process, I write a log entry to one of the tables in the database, commit & close the connection, and then copy the physical database(.mdf) file to some pre-determined location using the following instruction (in VB):
My.Computer.FileSystem.CopyFile("Path to Database File", "Destination Path")

It throws an exception saying that the file is in use. Upon checking, I found that the file has been locked-up by the Sql process.
I ensured that my app closes all connections to the database, that there is none other trying to connect to it, and then again tried to execute the above instruction in my app, again raising the same error.

However, when the app terminates, then I can easily copy the databse using explorer. I also used the OleDb method ReleaseObjectPool(), but the problem persisted.

So, how can I copy the database in such a situation from within my app??

View 3 Replies View Related

Creating Sql Server Ce Database File

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

Connect To A SQL Server Database File

Jul 12, 2007

Hi,

I am a beginner on using SQL Server Express. I have two different questions. Here is the first:

I've developed a simple C# application in Visual Studio 2005 that connects to a SQL Server database file. In the application I connect to the database using this connection string:



@"Data Source=.SQLEXPRESS;AttachDbFilename=C:Databasesmydatabas.mdf ;Integrated Security=True;Connect Timeout=30;User Instance=True";

and It works perfect.

But when I move the database file(and the corresponding log-file) to another computer it fails. I've changed the connection string to this



@"Data Source=.SQLEXPRESS;AttachDbFilename=\myserverDatabasesmydatabase.mdf ;Integrated Security=True;Connect Timeout=30;User Instance=True";



This is the error message I get when I try to open the database



The file \myserverDatabasesmyDatabase.mdf is on a network path that is not supported for database files.An attempt to attach an auto-named database for file \myServerDatabasesmyDatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.



Both computer runs Windows XP SP2.



My second question is:

When I deployed my solution to my production PC(witch also runs Windows XP SP2, .NET Framwork 2.0 is installed on the computer) .When I then tried to run the application I did get this error message

An error has occured when establishing a connection to the server. When connection to a SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remomte conections.....

Appearently I cant treat SQL Server database files in the same way as Access-files, or?



Jan Olsson



View 7 Replies View Related

Send A File From Database Without Saving It To Server First!

Jan 2, 2007

hi
I have binary files inside my database. and user should have the opportunity to download them from database to his computer. I don't want to retrive and save the file into the server first and then let him to download. is it posible???
thank you in advance
regards

View 3 Replies View Related

Download File That Is Stored In Sql Server Database

Feb 20, 2007

Hi, I have tried to implement file download option. I can download file which is stored in any folder. Code is...        string filepath = Request.Params["file"].ToString();        string filename = Path.GetFileName(filepath);        Response.Clear();        Response.ContentType = "image/gif";        Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);        Response.Flush();        Response.WriteFile(filepath);This code is working fine. But now I am facing a problem. Files (not the path) are stored in database table. User can download file from the database. How can I do this? The file may be a .txt, .doc, .xls, .jpg or .gif.

View 13 Replies View Related

How To Retrieve Video File From Sql Server Database

Apr 27, 2007

Hi
I uploaded a video file into the sql database converting into binary data.
i have a problem that to  retrieve video file(.wmv) from sql server 2000 database   and which has to play on media player.
Plz help me any one .
Itz urgent for my website.............
Plz plz Plz Help me Urgent...................
Thanks in Advance
Regards Shiva

View 11 Replies View Related

Ms Sql Mdf Database File Attached Vs Created On Sql Server

May 27, 2007

 Hi allI have a question concerning sql database mdf files. In the old days I would user a ms access database. This file would be stored with the actual web files and would utilise a dsn connection. I have noted when designing with vwd 2005 express it allows you to use 2 methods of creating a mdf database. You can either create it as an attachment mdf or you can create it directly using sql manager. My question is, if you create the mdf database as an attachement file can you store it in the same manner as if you where using a ms access database, meaning can you store it with the web site's files so it uses the file storage allocated size and then create a connection similar to a dsn (but for sql) to the isp's sql engine or does it have to be uploaded to the isp' s sql server.The reason for this question is some of my customers do not want to pay the extra cost to have an sql allocation, however I do not want to go back to using old asp methods to create advanced sites as I prefer using stored procedures. Any help will be appreciated 

View 4 Replies View Related

Import Flat File To A Sql Server Database..

Feb 20, 2008

Hi.
   I want to upload a Flat file from an asp.net website to a Sql server.. I have used olebb provider to upload excel files and a foxpro provider to upload DBF files and then used the sqlbulkcopy to put the data to my sql server..
 
SO i was wondering what kinda provider should i use to import a Flat file to the database and do i have use a format file in order to import it...
 Any help will be appreciated..
Regards,
Karen

View 7 Replies View Related

Adding SQL Server Database File To The Website

Apr 12, 2005

Hi!!!
I have a database called "test_DB" i have one table and some data on it. I uploaded the website and created an SQL Server account to upload the database. Can you please help me to do that task. Is there any step by step directions to do it and what files i need  to add  ( like ".mdf" or others...) I appreciate your help!!!
Thanks...

View 1 Replies View Related

Restore SQL Server Database From A File Backup

Mar 19, 2001

Hello,

I have a user database which has 1 data file and 1 logfile.
I did a complete backup of the database to a file on the disk drive, using Enterprise manager. Due to some reason, I had to drop the database. The only way I could restore it was by,
1. Create the database with the same name.
2. Restore the complete backup from the file device.

While doing so,
I get the message "Backup set holds the backup of daatabase other than the existing 'userdbname' database. BAckup terminating."

Is it because the database was dropped and recreated.
If I choose the option to overwrite, it restores successfully.

Is this normal and right way to do it? Is there any thing else that I need to take care of, while backup or restore?

Any suggestions welcome.
Thanks,
MMS

View 3 Replies View Related

SQL Server 2012 :: Database Log File Is Full?

Jul 10, 2014

I am receiving the below message however when going into my database properties and going into 'File' it's set as either unrestricted growth for the log files or 2097152MB limit and the log files are only taking up about 3gigs.

Could not allocate new page for database. There are no more pages available in the file group.

Database log file is full. Back up the transaction log for the database to free up some log space.

Could not allocate space for ojbect in database because the filegroup is full.

how I can resolve this and give it more space?

View 1 Replies View Related

SQL Server 2008 :: Insert The File In Other Database?

May 21, 2015

I work with sql server 2008 on a database.we have export schema and datas with the command export datas

click rigth on database => tasks => generate scripts => select all object => click advanced => select type of data to script => schema and data

Now we have a file with all datas and schema That's perfect ...But how i can insert the file in a other database?ok i can copy paste all datas in management studio and press f5 but when i do this the management studio fail because the size of the file is > 200 mega !

View 3 Replies View Related

SQL Server 2014 :: Recover Database Value Through LDF File

Jun 3, 2015

SQL server. By-mistake I updated values of a column in a database hosted online, is there any way undo the transaction. I didn't created any backup of the database. I read that still it can be recoverd through the .ldf (log file) but unable to access it. Is there anyway to get access of the Log file or is there any way to recover the data.

View 3 Replies View Related

SQL Server 2012 :: Database Backup Taken Twice Into Same BAK File?

Aug 13, 2015

I have accidentally taken the backup of a database twice into same .bak file. Now the file is twice the size. Will it be fine if I restore this backup? Or will I screw up any data?

View 1 Replies View Related

SQL Server Database Primary Data File

Aug 8, 2007



Hi Everone,
I need help on how to produce a SQL Server Database Primary Data File, i have read the Visual C# 2006 book by Deitel and Deitel unfortunately the book does not say how to produce the forementioned data file. The software that i currently have to help me produce this data file is Visual C#, J#, Web Development, SQL Server 2005 and Office 2007.

I have a good understanding of databases from studying SQL and Oracle but i am not sure which is the best software to use to produce the Primary Data File, ideally i would like to use Access from my Office 2007 package.

Many thanks for your help in resolving this problem.

View 4 Replies View Related

Not Able To Restore SQL Server Database From A Large Backup File

Aug 12, 2006

Hi everybody,
On executing the RESTORE command of SQL Server to restore from a backup of 78.3 MB, the "Server Application Unavailable" error message comes up.The error message in the Application log is as follows:aspnet_wp.exe  (PID: 2184) was recycled because memory consumption exceeded the 152 MB (60 percent of available RAM).
However using Query Analyser of SQL Server I am able to restore the database.
What is the solution to this problem?

View 2 Replies View Related

How Do I Convert Data From CSV File To Database In SQL Server 2000 ?

Oct 24, 2006

Hi,How could i do to convert data from CSV files to tables on database in SQL server 2000 ? Please show me !Thank very muchdvl_lang 

View 3 Replies View Related

Importing DataBase From SQL Server To An Mdf File Attached To The Project

Dec 25, 2007

Hi every body.
As you can see in the title I would like to import my tables from the data base which is in the SQL Server, to an mdf file which can be attached to the project.Can some one give an indice please?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved