what is sql injection in sql server?

Answers were Sorted based on User's Feedback



what is sql injection in sql server?..

Answer / venkat reddy.ravu

SQL injection is nothing but inserting malicious code with
the strings and later which will pass to the particular SQL
server instances which may damage the database or may
corrupt bthe data

For exaple:


var EmpName;
EmpName= Request.form ("EmpName");
var sql = "select * from Employee where EmpName= '" +
EmpName+ "'";


If you considers the above query and if user prompts to
enter the input as Scott,

Then query processed like this

select * from Employee where EmpName='Scott'

If user enters the input as below,

Scott,drop table Employee
In this case your query will be processed as below

select * from Employee where Ename='Scott',drop table emp

So,first select statement will be executed and then table
will be dropped.

Nothing but without standard of coding an expertised user
may damages or corrupt the databases.

To avoid SQL injection attacks:-
1)Use Parameterized Input with Stored Procedures
2)Use the Parameters Collection with Dynamic SQL
3)Filtering Input
4)LIKE Clauses

Is This Answer Correct ?    2 Yes 0 No

what is sql injection in sql server?..

Answer / pankaj kumar

SQL injection is something where an end user of an application is able to submit SQL queries through the user interface and end up running those queries, causing potential damage to the database.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is split brain scenario in DB mirroring?

1 Answers  


What about UPDATESTATISTICS ?

2 Answers   HCL, Intelligroup,


How to enter unicode character string literals in ms sql server?

1 Answers  


Give me a SQL Query to find out the second largest company?

1 Answers   Ernst Young,


What is the query optimization statistics?

1 Answers  


what's the difference between SQL & MY-SQl...? And what we learn from these ....?

2 Answers   Broadridge,


What is schemabinding a view?

1 Answers  


How to check parameter value in stored procedure sql server?

1 Answers  


Diff. b/w Full Outer Join And Cross Join?

3 Answers  


Does server sql treat char as a variable-length or fixed-length column?

1 Answers  


Can we update data in a view?

1 Answers  


Tell me what is the stuff and how does it differ from the replace function?

1 Answers  


Categories