Javatpoint Logo
Javatpoint Logo

Use of Single Quotes for Stored Procedure Parameters in SQL Server

Introduction

First let us know about the most sought out SQL Software which is known as SQL (Structured Query Language) Server. This server was introduced and developed by the most sought out company. The company name is Microsoft.

This is a Relational Database Server. This product is designed to perform the fundamental task of data storage and retrieval as needed by other applications. It can run on a single computer or multiple computers connected by a network.

This SQL Server was launched on April 24th, 1989. It can be downloaded easily. SQL Server is also an Open Source Software.

Now, let us know about the Single Quotes used for a Stored Procedure in SQL Server.

The Strings denoted in under only single quotes only (' ').

If the Strings are not under single quotes or may be under double quotes, then a run time error is thrown by the compiler to make us know that we are making a mistake.

The Server on which I am Performing SQL Operations are SQL SERVER 2019.

Stored Procedure

An SQL prepared code that may be saved and reused repeatedly is known as a stored procedure.

So, if you frequently develop SQL queries, save them as stored procedures and just call them to run them.

Additionally, you can send parameters to a stored procedure, allowing it to take action based on the value(s) of the past parameters.

Syntax

Example Programs

Before learning about example Programs let us learn about how these processes are executed on the SQL Server.

Syntax

This is the syntax of this process. Now let us immediately jump in to the examples

Example 1

Code

Output

Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Believe Become

(1 rows affected)

Example 2

Code

Output

Result
_ _ _ _ _
        269

(1 rows affected)

Example 2

Code

Output

Result
_ _ _ _ _
        269

(1 rows affected)

Example 3

Code

Output

Result
_ _ _ _ _ _ _ _ _ _ 
      829.17894999999999
(1 rows affected)

Example 4

Code

Output

Result
_ _ _
c

(1 rows affected)

Example 5

Code

Output

Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
I am lost for words. My mouth is probably dry out of emotions
(1 rows affected) 

Example 6

Code

Output

Result
Msg 102, Level 15, State 1, Server DESKTOP-Q5M2SGA, Line 2
Incorrect syntax near 'am'.

Example 7

Code

Output

Result
Msg 156, Level 15, State 1, Server DESKTOP-Q5M2SGA, Line 2
Incorrect syntax near the keyword 'not'.

This is all about single quotes case study. Now let us jump into Procedure Parameter time. But before jumping let us know about what is a procedure

Procedure

It is similar to functions or methods in other coding languages. In every procedure a few parameters are present. These Parameters takes a few values while procedure calling. The data types of the parameters are already specified in the procedure itself.

Even for the Stored Procedures the input must be called under single quotes only.

We are executing this in MS SQL Server. It is also known as SQL Server too.

Procedure 1

Using the Procedure now

Code 1

Output

Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
THINK

(1 rows affected)

Code 2

Output

Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a b c d e f g h I j k l m n o p q r s t u v w x y z
(1 rows affected)

Code 3

Output

Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
I had goosebumps, one of the greats of this game talking about Zimbabwe and in particular me

(1 rows affected)
Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
He just seems to know exactly what to do, when to do it.

(1 rows affected)

Code 4

Output

Msg 102, Level 15, State 1, Server DESKTOP-Q5M2SGA, Line 1
Incorrect syntax near 'just'.

Code 5

Output

Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
This product is designed to perform the fundamental task of data storage and retrieval as needed by other applications
(1 rows affected)

Code 6

Output

Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 Online Python DebBugger.  Code, Run and Debug Python program online. Please Compile Your Codes 
 (1 rows affected)

Code 7

Output

Result
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 Like Raza, he was also full of praise for the fast bowlers for setting the tone early 
(1 rows affected)

This is all about the topic Use of Single Quotes for Stored Procedure Parameters in SQL Server


Next Topic#





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA