16,004,686 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 9831003 (Top 5 by date)
Member 9831003
30-Mar-17 7:36am
View
could you please provide table structure with some sample data
Member 9831003
13-Dec-16 4:14am
View
you can try below code.
DECLARE @Inserttbl nvarchar(4000)
DECLARE @TableName varchar(50)
DECLARE @Text varchar(50)
--DECLARE @count int
SET @TableName = 'test'
SET @Text = NULL
if (@Text is not null)
begin
SET @Inserttbl = ' Insert into dbo.' + @TableName + ' values (3,' +''''+@Text+'''' + ',1)'
EXEC sp_executesql @Inserttbl
end
else
begin
Print 'NULL Value will not inserted'
end
And yes there is possibility of sql injection even under sp_executesql. Check below link also for validating your parameter
https://msdn.microsoft.com/en-us/library/ms161953(SQL.105).aspx
Member 9831003
12-Dec-16 4:07am
View
try with xml data type. Check below link may be help full
http://stackoverflow.com/questions/2497678/storing-json-in-an-mssql-database
Member 9831003
8-Nov-16 4:05am
View
Thanks, if possible can you please make some insert statement for these tables.
Member 9831003
4-Nov-16 9:25am
View
Send your table schema with sample data