Click here to Skip to main content
14,734,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Team,
i have file .sql and they content upto 150 mb file size when i execute in SQL Server then get file size heavy and execute error.


Have any other way restore .sql file in database like .bak file .



Regards
Rohit Kumar Singh
9810353598
Posted
Comments
ssd_coolguy 19-Feb-13 4:44am
   
can you tell us.. what exactly that sql file contain..?
is there any query?
rohit_singhk 19-Feb-13 5:31am
   
DataBase Script with Data Contain
rohit_singhk 19-Feb-13 5:47am
   
Dear File extension is .sql not .bak file got it?
File Path like :
E:\New folder\DCE_Script_With_Data.sql

Again i told not like .bak if it is .bak file i easily restore?

And .SQL extension direct open in new query window if file size not more than 150 MB.


rohit_singhk 19-Feb-13 6:38am
   
CALL sqlcmd -w 125 -S %ROHIT-PC% -d %DCORE_19022013% -U%sa% -P%boss% -l30 -b -I -i "E:\Dcore_GGN_Even_20April2012_1013hrs.sql"

Like that
rohit_singhk 19-Feb-13 6:40am
   
Server Name : ROHIT-PC
DataBase : DCORE_19022013
User ID : Sa
Password : boss
File Sources Path : E:\Dcore_GGN_Even_20April2012_1013hrs.sql

Now what is query direct exceutable

hi,

Try this code....
DECLARE @SqlString VARCHAR(1000)
SELECT @SqlString = 'BACKUP DATABASE eUnderwrite TO DISK = ''path'+ REPLACE(CONVERT(VARCHAR(15),GETDATE(),106),' ','_')++'_'+REPLACE(CONVERT(VARCHAR(25),GETDATE(),108),':','_')+'.bak'' WITH INIT'
PRINT @SqlString
EXEC (@SqlString)
   
You can try SqlCmd utility. Code like
CALL sqlcmd -w 125 -S %Server% -d %Database% -U%uid% -P%pwd% -l30 -b -I -i  "dbscript.sql"


In details you can check SqlCmd Utility
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900