Is there the option to check syntax after I have completed create a query? If so, where can I find it? What does it validate and what does it not validate?
标签:
sql-server-2008
相关问题
- SQL to Parse a Key-Value String
- How to evaluate an input in the WHERE clause
- employee id automatic generate with prefix
- update user details, sql server 2008 sqlsrv
- Calculating the 95th Percentile value?
相关文章
- Code for inserting data into SQL Server database u
- SQL Server 2008 Change Data Capture, who made the
- How do we alias a Sql Server instance name used in
- How to do a UNION on a single table?
- SQL Group by Count of Counts
- SQL Server drop and recreate indexes of a table
- How to generate sequential row number in tsql?
- Pass table as parameter to SQLCLR TV-UDF
This will validate your objects as well. It will give you the error if you do not have that object present in your database. It will not execute your Query on the database but only parse it and validate syntax and objects.
You can click the
Parse query
button in Management Studio. It's the blue check mark on the toolbar (you can also use Ctrl + F5):This only validates syntax, and doesn't check that the objects you've referenced exist, that joins are valid, etc. For example the following parses correctly since deferred resolution assumes that by the time you run the query "for real" the object will exist:
This also passes parsing:
Even though
sys.objects
exists but does not contain the columnbar
.It is essentially the same mechanism that allows you to compile a stored procedure that references objects that don't exist yet (which of course will fail at runtime).