Optional output parameter sql sp_executesql

Optional output parameter sql sp_executesql

Posted: BlackPearl Date: 04.06.2017

By posting your answer, you agree to the privacy policy and terms of service. Stack Overflow Questions Developer Jobs Documentation beta Tags Users. Sign up or log in to customize your list. Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us.

Log In Sign Up.

Join the Stack Overflow Community. Stack Overflow is a community of 7.

optional output parameter sql sp_executesql

Join them; it only takes a minute: I would like get the ID from the query, but I am getting a NULL, where is my mistake? I cant see my mistake? If you are going to allow the table name as parameter not a great idea you need to wrap the parameter inside QUOTENAME at the very least to help prevent sql injection.

Also, use top without an order by is not a good practice. You don't know which row is going to be returned and it can change between executions.

You should always have an order by when using TOP. Deepak Pawar 2, 4 MeerArtefakt elaborated the answer.

How to call a stored proc with optional parameters using sp_executesql

Sign up or log in StackExchange. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name.

How to handle sp_executesql input parameter limitations.

Stack Overflow works best with JavaScript enabled. MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3. Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.

inserted by FC2 system