No new comments.
View All Comments
No new messages.
View All Messages
No new notifications.
View All Notifications
LEARN: Introduction to Entity Framework
An Interview Question
Ask a Question
How do I
Coding Best Practices
Internet & Web
Internet of Things
Universal Windows Platform
VR and AR
Databases & DBA
Design Patterns & Practices
C, C++, MFC
Request a new Category
Where to Use SQURE Bracket Around Table Name
Have you ever thought, what if your table name
Is exactly the same as a SQL Server keyword
Has a space in it like "Student Fav Actor"
If you go ahead and query against the table "Student Fav Actor" like below, most likely you will get an error message as below:
There may be one more scenario where the table name is something like FROM. If you query in the usual way, obviously you will be getting an expected error message.
So how to query table named [However this is wrong practice to put spaces and use SQL Server keyword as table name] like above?
The solution is very simple; put the table name in square brackets.
You might encounter columns name of table are having spaces or named as keywords. In that case also you need to apply square bracket with that particular column name to work with.
Query a range of characters?
If you need to query all People from the Person table with a FirstName starting with A, then you can easily query like below:
What if you want to list all the people from the person table with the first name start with A and B? You can combine the Like operator with OR and query like below:
But imagine the scenario where you need to query all the People with FirstName starting with A to M. How will you do that?
The solution is you need to put the like operator in the square bracket as below:
If you modify one little thing in the above query and replace the like operator with an equal operator, you will get no error message however you will get no rows returned as well.
SQURE Bracket in sql server
Introduction To Entity Framework
Exception Handling Mechanism In .NET
Creating ASP.NET Core, Angular2 Shopping Cart Using Web API And EF 1.0.1
Calculating Distance Using Google Maps In ASP.NET MVC
Learn Big Data With Me - Hive
Calling A C# Function With jQuery AJAX In ASP.NET MVC
AngularJS Login Form With ASP.NET
Getting Started With SQL Server 2016
Five Free Productivity Tools That Every Web Developer Should Use
HTTP Get, Put, Post And Delete Verbs In ASP.NET WEB API