# notation in SQL Server [duplicate] - sql

This question already has answers here:
What does the "#" symbol do in SQL?
(7 answers)
Closed 7 years ago.
I am new to SQL Server, can someone help me what is the significance of # notation followed by name of variable? Like #OrderId ?

All SQL Server variables are prefixed with #.
#local_variable
Is the name of a variable. Variable names must begin
with an at (#) sign. Local variable names must comply with the rules
for identifiers.
https://msdn.microsoft.com/en-us/library/ms188927.aspx

Related

Display ➜ symbol in Microsoft SQL Server [duplicate]

This question already has answers here:
What is the meaning of the prefix N in T-SQL statements and when should I use it?
(4 answers)
Why is sql server storing question mark characters instead of Japanese characters in NVarchar fields?
(8 answers)
Closed 4 months ago.
I have a text in the database with the symbol "➜". When I display it on the web page, I get a "?" instead. Can someone help me?
Best regards

SQL Server - what does it mean `N'some string`? [duplicate]

This question already has answers here:
What does N' stands for in a SQL script ? (the one used before characters in insert script)
(7 answers)
Closed 5 years ago.
What does it mean N'some string' in SQL Server. I mean if I can use it to prevent against SQL Injection?
For example:
... LIKE N'%somePattern%'
Is SQL Injection safe ?
The N has nothing to with SQL injection. You need to use it when you use unicode data
From msdn:
Prefix Unicode character string constants with the letter N. Without
the N prefix, the string is converted to the default code page of the
database. This default code page may not recognize certain characters.
It means the string is an nchar as opposed to a char (see What is the difference between char, nchar, varchar, and nvarchar in SQL Server?)
It's purely about the datatype - nothing to do with SQL injection at all.

How to Check the given string is a reserved keyword in sql server [duplicate]

This question already has answers here:
Check if string is SQL Server Reserved Keywords or not
(3 answers)
Closed 8 years ago.
How to check whether the given string is a reserved keyword in sql server.
I checked a lot in google ,but i didn't find one!!
for eg: If i am giving the input String as 'Order',sql statement should
return whether it is reserved keyword.
Is there any built-in stored procedures or function to do this? Any help would be appreciated.
There is no built-in function to do that.
Here is the list of the known identifiers.
http://technet.microsoft.com/en-us/library/ms189822.aspx
I suggest to put these in an table and use it in a function / stored procedure.

Create custom configuration functions in SQL SERVER [duplicate]

This question already has answers here:
Create a global static variable in SQL Server?
(4 answers)
Closed 9 years ago.
I want a function similar to ##servername to be created. So, the new ##mycustomname will return something I set up and then I can use ##mycustomname in my deployed T-SQL Scripts.
Is there a way to do it?
No you can't. These are reserved keywords.
What you want to be somewhat equivalent to global variables, which unfortunately does not exists.
The best you can do is declare a function.

IS vs AS keywords for PL/SQL Oracle Function or Procedure Creation [duplicate]

This question already has answers here:
What is the difference between "AS" and "IS" in an Oracle stored procedure?
(6 answers)
Closed 9 years ago.
I have been trying to find out what the difference is between the IS and AS keywords in PL/SQL when creating an Oracle function or procedure.
I have searched and have been unable to find any information on this. Does anyone know the difference?
I've never known there to be a difference. The Oracle documentation implies that they are synonyms:
The function body begins with the keyword IS (or AS) and ends with the keyword END followed by an optional function name.
Same as DISTINCT and UNIQUE in select statements.
i.e, there is no material difference between 'IS' and 'AS'.
Backwards compatibility and meeting standards