0

I have an SQL script file which it has big size " 1.4 GB " when I try to open it in SQL SERVER Management Studio it fails and give me message

The System can't find the file specified

when I try to open it with notepad++

file is too big to be opened by notepad++

so does it there anyway to open this script ?

Mahmoud Zakal
  • 128
  • 3
  • 15

1 Answers1

0

Run this command in Command prompt by providing the required details. This command would execute the SQL file without opening the file.

sqlcmd -S <ServerName> -U <LoginUser> -P <Password> -d <DatabaseName> -i <Inputfilenamewithpath> -o <Outputfilenamewithpath>
StackUser
  • 5,370
  • 2
  • 24
  • 44
  • what if I want to change the used database in script because when create the script the `use XXXDb` command for that DB will be in the first line – Mahmoud Zakal Aug 10 '16 at 07:43
  • Regenerate your SQL script without using "USE" statement Or else you should edit the Use XXXDb with your desired DBname by opening the SQL script. – StackUser Aug 10 '16 at 07:48
  • here's the problem that I can't find a tool can open that file to edit it otherwise i have to read and edit it programmatically – Mahmoud Zakal Aug 10 '16 at 07:51
  • You said you cannot open that file then how do you say that file has Use statement.... – StackUser Aug 10 '16 at 07:53
  • because when I create an Sqlscript in management studio the use statement will be in the first line – Mahmoud Zakal Aug 10 '16 at 08:08
  • Regenerate your script by disabling the option "Script USE DATABASE" to False. You can find this option in Advanced button. – StackUser Aug 10 '16 at 08:55