Use .sql File To Create DB
Nov 19, 2007Dear all,
May I know how can I create a DB by using a provided .sql script file in sql server 2005?
Thanks
Levine
Dear all,
May I know how can I create a DB by using a provided .sql script file in sql server 2005?
Thanks
Levine
Hi,
I am looking for tutorials about how to create dts et dtsx files.
Thanks for your help.
Arioule.
I have used the copy database wizard, but I realized I had forgotten to shrink the transaction log file. So I canceled the wizard. My database, detached by the wizard, has now disappeared. The mdf file is still there, but when I try to attach it manually I get the "create file encountered operating system error 5 while attempting to open the physical file..." error.
Any way I can recover it?
Thanks.
Every day we are restoring prod DB in Development env. I need to save before restore users stored proc,
restore DB and after create SP from file.
Thanks.
Hello friends,
I have the following (simplified):
1. Flat File Source
2. Conditional Split, Case Good = !ISNULL(KEY) Case Error = ISNULL(KEY)
3. Case Good -> Writes to Good Flat File (with timestamp in the title)
4. Case Error -> Writes to Error Flat File (with timestamp in the title)
Most job runs have no errors but the error file is created as a zero byte file anyway. If there are no error records I don't want the error file created. How might I accomplish this?
Thanks
Executed as user: S233683-AD01S233683NJ3SQL05. ...at file already exists.' [SQLSTATE 42000] (Error 22048) ERROR -- Could not backup database: master - BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 50000) xp_create_subdir() returned error 183, 'Cannot create a file when that file already exists.'
View 2 Replies View RelatedHello all,
Please help....
I have a text file which needs to be created into a table (let's call it DataFile table). For now I'm just doing the manual DTS to import the txt into SQL server to create the table, which works. But here's my problem....
I need to extract data from DataFile table, here's my query:
select * from dbo.DataFile
where DF_SC_Case_Nbr not like '0000%';
Then I need to create a new table for the extracted data, let's call it ExtractedDataFile. But I don't know how to create a new table and insert the data I selected above into the new one.
Also, can the extraction and the creation of new table be done in just one stored procedure? or is there any other way of doing all this (including the importation of the text file)?
Any help would be highly appreciated.
Thanks in advance.
hey guys,
i have the job of transfering a mature database to a new server. i have done this before with the import/export utility with ease before. but this hosting company only allows import with .sql files. on my import/export program there is no .sql export option. does anyone have any ideas?
i want to export the table designs and the content.
hi i have to export some databases to a xls File with DTS and VBA on a MIcrosoft SQL Server 2000.
in Dts it is not very difficult but i have to do this dynamicly. So i have to create a new xls File with Scripting FileSystemObject
but on the server is no Excel Application.
u know how i can do this?
i have mayby a solution:
1.archiving the data static
2.copy the file to other folder
3.rename the new file
but then i have to delete the value of the static file before a job, otherwise the file will be bigger and bigger.
any ideas?
thx
how do i create a log file after i exec a proc.
View 6 Replies View Relatedhi,
i am using c# asp.net with sqlserver.
so i a m inserting values from front end to back end.
my need is i have to create logfile at which time i inserted,in which table i inserted,who is inserted and which operation performed.so these things i have to maintain in log file.
this is my need.
actually i tried this by the following way:
i created the table log:
which cotains the following field.
name,desc,tablename,date
then i created one stored procedure :code:
CREATE PROCEDURE splog
(@name varchar(50),
@desc varchar(50),
@tabname varchar(50),
@date datetime
)
As
begin
insert into log values
(
@name,@desc,@tabname,getdate()
)
end
GO
then i created stored procedure for insert as follows:
CREATE PROCEDURE spemp1insert
(@name varchar(50),
@age int,
@id int
) As
begin
insert into emp1 values(@name,@id,@age)
if(@@error=0)
begin
execute splog @name='karthikeyan',@desc='insertoperation',@tabname='emp1'
end
end
GO
but if i inserted my record from c#asp.net to sqlserver the record getting inseretd,but in the log table the is is no value.
so please tel me what problem i did,please help me to do this,please
hi ,
i just want to create a sdf file using Sql server 2005 CE. I am very new to CE.
can anybody tell me how to create that file???????
thanx in advance
So we have this database in SQL 2005, and we want to create a SQL Mobile database filled with a subset of data from that SQL 2005 database.
Replication is NOT an option for us (otherwise, believe me, we would be down that road in a heartbeat). Hence why we're trying to create the files manually.
Now, I know I could write an app that creates the .SDF file, gets the data from the master and puts it in the mobile one...but if there's a way to do it using the SQL manager or the BI development studio, I'd rather do it that way.
Any thoughts on this?
Thanks!
D
hi In my application i want to create a TestDB using script method. I want to send it to the client through( Websetup Project). So i need to send the exe for that TestDB.sql.
I have created the TestDB.sql ( using script method). Now i need to chnage that TestDB.sql into an exe file...( SQL SERVER 2005 )
Client can click the exe. It should execute the scrpts and automatically create the database( TestDB) in client machine.
can you any light on this issue for me..
thanks in advance
Prabakar
hi all!
i am sorry about this question but i am new to sql server.i installed sql server 2005 developer edition but there are only a few configuration tools on my computer.i used to use access but i dont know how to create a sql database file?did i install a wrong type of sql server??if not why i cant find a way to create this database??pls help meeeee!!!!!
I was running a Evaluation copy of SQL 7 and suddenly it expired. I couldn't start the SQL service any more therefore I couldn't make a backup of my database. Now I installed new SQL 7 server and my database file (xx.mdf and xx.ldf) are there. Is there a way that I can recover my databases from those files?
Thanks.
Ronnie
ronnie.gu@newsedge.com
Is there a way in a stored procedure to create a text file with the results from a query?
If not, is there a way to execute a DTS package from a stored procedure?
Thanks,
Ken Nicholson
I have a stored procedure. This proc returns some data that needs to be put in an excel format. Is it possible to create a excel file to have the result of a select statement from the database?
Thanks
this is the worst noob question ever but Google isn't helping and I searched all the threads in this forum...no help. I have a comma delimited csv file that i need to load into an existing database on MS SQL 2000. I need to know how to create the table and populate it with my data...Any pointers of the differences between syntax Of MSSQL and MySql or a tutorial of how to do it with enterprise manager would be great...Dang I feel noobie.
View 2 Replies View RelatedI'm looking for a simple way to create a text file inside a stored procedure. I want to set it up so the end user would just execute the SPROC that would run the required queries and dump the result into a custom formated text file.
I tried BCP but could not lauch it inside the SPROC without using OSQL. I am running SQL Server 2003 64bit. Any ideas?
I need to create/read files from t-sql? Does anyone know how can I do it?
Thanks
I found this from a web site
SELECT * FROM Salesorders;
OUTPUT TO 'C: etssales.csv'
FORMAT TEXT
QUOTE '"'
WITH COLUMN NAMES;
However I do not want the delimiter to be a comma. Instead I plan to use something like ****%****
I want to do a SQL sentence that saves the results from the select in a .txt file.
I get the results as a long list on the screen, and it repeats the headers several times, so it takes quite some time to copy the results out of there. It would be better if the result was put as a list directly in to a text file.
Anyone know how I can do that?
Hi!
I'm trying to create a txt file using the information of my PO lines tables, is there any way to do this using a SP.
Is there a way to create a text file (such as a Windows Notepad file)by using a trigger on a table? What I want to do is to send a row ofinformation to a table where the table: tblFileData has only onecolumn: txtOutputI want to use the DB front end (MS Access) to send the text string tothe SQL backend, then have the SQL Server create a file to a path,such as F:/myfiledate.txt that holds the text in txtOutput, then thetrigger deletes the row in tblFileData.Can this be done easily?Any help is appreciated
View 9 Replies View Relatedhi everyone,
Does anyone ever used or created something like that? What kind of format it might be and so on...
TIA
Hi ,
I need to create a CSV file by reading a table data , Can any one know how i can do this using SSIS .
My Requirment is that -
I have a temp table in which i inserted all the incorrect data during the load of a flat file using SSIS. Now i need to write all the incorrect data of the temp table in a CSV . Is there is a way i can do this using SSIS , Please help as i am new to SSIS.
Regards,
Ashish Soni
Hi!!
I have a report that is exported to a PDF file... Is possible to get an index in the beginning of the file?? I have the page number at the bottom of each page but i would need an index...
Thx in advance!!
Hi everybody,
I'm working with a SQL Server 2000 Database and I need to write a procedure that creates a file .log in which it has to write some potential errors occurred in other procedures.
I'm quite totally newbie to T-SQL language and its procedures, so I don't know which procedure or function creates and closes the file and which one writes something in it.
Thanks for your help.
Hello,
I'm using MS Visual C# 2005 Express, but I can't create a new local database file in the "Add -> New Item" dialog. The Studio doesn't create the database, but shows a file not found message.
Any ideas?
When I create a table I can create it in a filegroup, but how do I put it in a file. Example---
I have two files in one filegroup called "Secondary" file A and file B.
I want to create a new table called tableA and put it in file B on filegroup Secondary.
I looked at bookes online and can't find it.
Thanks
Thomas
Hi,
I am trying to create a script that will create a backup (or copy) of an sdf database.
I have a database already in my application working nicely and want the user to have the option to backup that file so if anything goes wrong they will be able to click a button and it will restore all the data to the database. I am not sure which options are best for me. there are 3 main ones i have considered, these are:
1) Create a text file with all the data in it.
2) Create a HTML file with the data in it.
3) Create an xml file with the data in it.
Help would be appreciated. Thanks =]
Hi,
i am dev new project which will be having 10 packages which can be having many source conn mgrs (flat file connection managers).
usually we will give file path when creating filat file conn manager. like that i many do for all packages.
when package is executed it searches for that file path in conn manager and file get execute where data is available normally.
But my req is i have to create file (say xml) where the path of folder(bec all the files which are used by all packages will be available in the same folder) should be available.
so server while executing package it has to search that xml first where it should find the path of the file and finally file has to be executed.
how can i acheive that req.plz guide me