Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9246805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:34:44+00:00 2026-06-18T09:34:44+00:00

How do I add double quotes to a SQL parameter variable (SQL Server 2008

  • 0

How do I add double quotes to a SQL parameter variable (SQL Server 2008 R2) in a stored procedure safely?

I have this:

CREATE PROCEDURE procedure1 (@var1 NVARCHAR(100))
AS

DECLARE @var2 NVARCHAR(100);
SET @var2 = '"' + @var1 + '"';

SELECT * FROM TABLE1 WHERE CONTAINS(col1, @var2);

END

So is my SET @var2 statement vulnerable to SQL injection? Is there a recommended way of adding strings together?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:34:45+00:00Added an answer on June 18, 2026 at 9:34 am

    That’s fine.

    Issues with concatenating quotes and SQL injection only arise when you are doing so to create a SQL statement that you then EXEC-ute in some manner.

    Concatenating them to a variable that is not itself concatenated into a SQL statement is not a SQL injection issue. The variable @var2 is treated as data rather than executable code throughout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using a Stored procedure on SQL 2008 and C# 4.0, I am unable
I have a stored procedure as follows create procedure [dbo].[PriceConfirm] @quote float, @membershipType int,
I'm looking to add double buffering to a drawing function like this. dc =
I was trying to add double quotes to a name in R and it
I've a query like this, which is already in double quotes. result = db.Query(SELECT
i have one database problem, if my sql is like this: Dim Username Username
In my below mentioned reqular expression, how can i add double quotes ? <asp:RegularExpressionValidator
I have a string variable such as this: string title = string.empty; I have
I have a json_encoded array which is fine. I need to strip the double-quotes
I am trying to add this HTML/JavaScript code into a jQuery variable. I've managed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.