Click here to Skip to main content
15,881,859 members
Home / Discussions / Database
   

Database

 
GeneralRe: Problem with row concatenation Pin
pmarfleet17-Oct-07 20:15
pmarfleet17-Oct-07 20:15 
AnswerRe: Problem with row concatenation Pin
manojm3917-Oct-07 20:18
manojm3917-Oct-07 20:18 
GeneralRe: Problem with row concatenation Pin
Payal_e_m18-Oct-07 16:28
Payal_e_m18-Oct-07 16:28 
QuestionHow to Install SSL in Workgroup Environment for SQL Server? Pin
DotNetWWW17-Oct-07 2:54
DotNetWWW17-Oct-07 2:54 
AnswerRe: How to Install SSL in Workgroup Environment for SQL Server? [modified] Pin
Mike Dimmick17-Oct-07 6:22
Mike Dimmick17-Oct-07 6:22 
GeneralRe: How to Install SSL in Workgroup Environment for SQL Server? Pin
DotNetWWW1-Nov-07 5:40
DotNetWWW1-Nov-07 5:40 
QuestionDynamic ColumnName in Stored Procedure Pin
Herman<T>.Instance17-Oct-07 2:27
Herman<T>.Instance17-Oct-07 2:27 
AnswerRe: Dynamic ColumnName in Stored Procedure Pin
Colin Angus Mackay17-Oct-07 2:40
Colin Angus Mackay17-Oct-07 2:40 
You are using dynamic SQL where you are concatenating a string together to make a full statement. You have not sanitised the values @Table, @FieldInTable and @CodeInGrid. This means your application is susceptable to a SQL Injection Attack. Please read this[^]

All column and table names are nvarchar(128)

If you must do this then please check that @Table and @FieldInTable (actually, they are called columns in SQL Server) are valid first

This might be a starting point for the checking that the table and column name are valid:
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @Table

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = @fieldInTable AND TABLE_NAME = @Table

Also, table and column names should be wrapped in square brackets in case they contain obscure characters or whitespace.

@CodeInGrid I presume is an integer as you don't wrap it in apostrophes in your dynamic SQL. If so pass it as an integer and NOT as any sort of string type. This can easily be cast to a string for concatenation with the rest of the satement.


Upcoming FREE developer events:
* Glasgow: SQL Server Managed Objects AND Reporting Services ...

My website

GeneralRe: Dynamic ColumnName in Stored Procedure Pin
Herman<T>.Instance17-Oct-07 3:03
Herman<T>.Instance17-Oct-07 3:03 
GeneralRe: Dynamic ColumnName in Stored Procedure Pin
Colin Angus Mackay17-Oct-07 3:11
Colin Angus Mackay17-Oct-07 3:11 
GeneralRe: Dynamic ColumnName in Stored Procedure Pin
Colin Angus Mackay17-Oct-07 3:38
Colin Angus Mackay17-Oct-07 3:38 
GeneralRe: Dynamic ColumnName in Stored Procedure Pin
Herman<T>.Instance17-Oct-07 3:46
Herman<T>.Instance17-Oct-07 3:46 
QuestionHelp with a SELECT statement required pls. Pin
Steven J Jowett17-Oct-07 2:27
Steven J Jowett17-Oct-07 2:27 
AnswerRe: Help with a SELECT statement required pls. Pin
Colin Angus Mackay17-Oct-07 2:43
Colin Angus Mackay17-Oct-07 2:43 
GeneralRe: Help with a SELECT statement required pls. Pin
Michael Potter17-Oct-07 10:15
Michael Potter17-Oct-07 10:15 
GeneralRe: Help with a SELECT statement required pls. Pin
Colin Angus Mackay17-Oct-07 10:17
Colin Angus Mackay17-Oct-07 10:17 
GeneralRe: Help with a SELECT statement required pls. Pin
Michael Potter17-Oct-07 11:40
Michael Potter17-Oct-07 11:40 
GeneralRe: Help with a SELECT statement required pls. Pin
Steven J Jowett17-Oct-07 22:41
Steven J Jowett17-Oct-07 22:41 
QuestionDatatype for NULL Pin
N a v a n e e t h17-Oct-07 2:03
N a v a n e e t h17-Oct-07 2:03 
AnswerRe: Datatype for NULL Pin
Mike Dimmick17-Oct-07 2:22
Mike Dimmick17-Oct-07 2:22 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 2:41
N a v a n e e t h17-Oct-07 2:41 
GeneralRe: Datatype for NULL Pin
Colin Angus Mackay17-Oct-07 2:45
Colin Angus Mackay17-Oct-07 2:45 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 2:50
N a v a n e e t h17-Oct-07 2:50 
GeneralRe: Datatype for NULL Pin
Mike Dimmick17-Oct-07 6:33
Mike Dimmick17-Oct-07 6:33 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 18:26
N a v a n e e t h17-Oct-07 18:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.