15,906,341 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 Python 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 Putchicks (Top 8 by date)
Putchicks
5-Jun-15 9:18am
View
Thanks CHill60. I was out of the office, sorry for the late reply. I will try to remove TRY-CATCH.
Putchicks
29-May-15 15:04pm
View
Thanks Richard Deeming for the suggestion, though this is not my issue right now and not a priority but will consider your suggestions. Do you happen to have a sample for us of parameterized query.
Putchicks
29-May-15 14:51pm
View
Thank you very much for the prompt response RyanDev.
I cannot a run a trace (profiler) because I am not a member of sysadmin.
Putchicks
9-Apr-15 10:30am
View
Thanks RyanDev. I too also think that this is not possible but is there any way that I can do similar to this. Any idea? Thanks.
Putchicks
8-Apr-15 16:48pm
View
Sorry RyanDev I somehow deleted the @PK in below line, appreciate your help on this
EXECUTE dbo.sp_executesql @S, @P, @PK, @pOldPK OUTPUT
Putchicks
8-Apr-15 16:27pm
View
Thanks RyanDev. Please see below code:
DECLARE @OldPK AS VARCHAR(50)
DECLARE @PK AS VARCHAR(50)
DECLARE @S AS NVARCHAR(MAX)
DECLARE @P AS NVARCHAR(MAX)
DECLARE @pPK AS VARCHAR(50)
SET @PK = 'ModeName'
SET @S = N'SELECT TOP 1 @pOldPK = ' + QUOTENAME(@pPK) + ' FROM Modes '
SET @P = N'@pOldPK VARCHAR(50) OUTPUT'
EXECUTE dbo.sp_executesql @S
, @P
, @PK
, @pOldPK = @OldPK OUTPUT
SELECT @OldPK
this generates a NULL value it supposed to give a 'xxx'
Putchicks
8-Apr-15 15:52pm
View
Thank RyanDev. I rectified the error in codes but it doesn't give me what I want to have a dynamic column (injected by user). please see below changes:
DECLARE @OldPK AS VARCHAR(50)
DECLARE @S AS NVARCHAR(MAX)
DECLARE @P AS NVARCHAR(MAX)
DECLARE @pOldPK AS VARCHAR(50)
SET @S = N'SELECT @pOldPK = m.ModeName FROM Modes m'
SET @P = N'@pOldPK VARCHAR(50) OUTPUT'
EXECUTE dbo.sp_executesql @S, @P, @pOldPK OUTPUT
SELECT @pOldPK
and it gives me the value sample "XXXX" when executed...
Putchicks
8-Apr-15 14:46pm
View
I tried to run the in SSMS - Thanks Sergey
Show More