Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
devd
Starting Member
1 Post |
Posted - 2012-07-24 : 15:05:51
|
HiIs there any way to compile the sql files and check for syntax errors through cmd.Example :-------------------------------------Correct Syntax :INSERT INTO Persons VALUES ('Nilsen')-------------------------------------Wrong Syntax :INSERT INTO Persons VALUE ("Nilsen")Wrong syntax at values and "Second Question :Can we compile the sql file (Syntax error) with out executing the sql scripts (insertion of data)? |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-07-24 : 15:11:13
|
If you place SET FMTONLY ON at the beginning of your script it will only parse the text. |
|
|
komkrit
Yak Posting Veteran
60 Posts |
Posted - 2012-07-25 : 13:45:50
|
To devd, and additional to robvolkFor my quick tip, I usually use "Parse" button in SSMS (locate at toolbars)or Menu "Query" --> "Parse"For shortcut, use Ctrl-F5It won't execute, but only check syntax. Safe to your data.Please noted that, "Parse" is just check syntax, but not object validation.In the case object does not exists, parse won't notified.I usually use "Ctrl-L" or "Display Estimated Execution Plan" button to check syntax and validate object without executing.Also safe to data.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Komkrit YensirikulCurrently be a DBA in worldwide hotel reservation. Experienced in top leading banking environment. |
|
|
|
|
|