sp-executesql Questions
11
Solved
When dealing with debugging queries using Profiler and SSMS, its pretty common for me to copy a query from Profiler and test them in SSMS. Because I use parameterized sql, my queries are all sent a...
Reber asked 16/7, 2009 at 15:23
10
Solved
Was trying to select...into a temp Table #TempTable in sp_Executedsql.
Not its successfully inserted or not but there Messages there written
(359 row(s) affected) that mean successful inserted?
Sc...
Flurry asked 7/11, 2011 at 17:22
4
Solved
How to pass the parameters to the EXEC sp_executesql statement correctly?
This is what I have now, but i'm getting errors:
alter PROCEDURE [dbo].[usp_getReceivedCases]
-- Add the parameters for...
Characharabanc asked 12/2, 2015 at 15:20
5
I'm trying to pass a TABLE variable to the sp_executesql procedure:
DECLARE @params NVARCHAR(MAX)
SET @params = '@workingData TABLE ( col1 VARCHAR(20),
col2 VARCHAR(50) )'
EXEC sp_executesql ...
Spokane asked 23/11, 2010 at 17:13
3
Solved
I'm writing a stored procedure in SQL Server 2005, at given point I need to execute another stored procedure. This invocation is dynamic, and so i've used sp_executesql command as usual:
DECLARE @...
Conventual asked 29/8, 2013 at 15:36
7
I'm trying to dynamically create triggers, but ran into a confusing issue around using sp_executesql and passing parameters into the dynamic SQL. The following simple test case works:
DECLARE @tab...
Nambypamby asked 30/1, 2019 at 17:56
2
Solved
I had a query with a set of parameters that needed to be run multiple times with different parameters, so I wrapped it in a table-valued function.
That table valued function needed called from a r...
Jard asked 11/6, 2012 at 14:43
1
Given:
CREATE PROCEDURE [dbo].[my_storedproc]
@param1 int, @param2 varchar(100)
AS
<<whatever>>
GO
Are there known performance differences between these different execution methods...
Lindquist asked 5/3, 2015 at 18:47
1
Solved
is there any way that you can call sp_executesql with parameters that don't depend in the order they are defined in the store? the same query with exec works well, and if you have the same order it...
Mayor asked 11/2, 2015 at 14:45
2
Solved
DECLARE @sql NVARCHAR(max)
DECLARE @ParmDefinition NVARCHAR(500)
SET @sql = 'UPDATE [Table1] SET [Table1].[@columnName] = TEST';
SET @ParmDefinition = N'@columnName NVARCHAR(50)';
EXEC sp_executesq...
Basidium asked 8/1, 2015 at 22:50
1
I'm having problems with slow performance in a sql select statement with some parameters, for the same query, executing this select using sp_executesql way it takes double time that the inline-way....
Tectonics asked 6/8, 2014 at 11:21
2
Solved
I have multiple EXECUTE IMMEDIATE commands within one oracle procedure.
EXECUTE IMMEDIATE 'DELETE FROM tbl1';
EXECUTE IMMEDIATE 'INSERT INTO tbl1...';
COMMIT;
EXECUTE IMMEDIATE 'DELETE FROM tbl3...
Incompetent asked 6/12, 2013 at 20:34
2
I have large queries
so i cant use linked server in production by rules.
i pass a varchar(max) which this has more than 8000 characters.
but sp_executesql does not support more than 8000 character...
Wyrick asked 2/10, 2013 at 14:28
2
Solved
I'm encountering some major performance problems with simple SQL queries generated by the Entity Framework (4.2) running against SQL Server 2008 R2. In some situations (but not all), EF uses the fo...
Venation asked 14/2, 2012 at 1:24
1
Solved
I need help with passing my "user defined table type" parameter to dynamic sql, sp_executesql.
Here's my sample code:
DECLARE @str as nvarchar(Max)
DECLARE @IDLIST AS ListBigintType /* this is my...
Folkway asked 3/11, 2011 at 17:38
2
Solved
As the title states, I don't understand why the sp_executeSQL would generate a completely different execution plan than running the query from Sql Management Studio.
My query in question will take...
Glut asked 30/3, 2011 at 14:44
2
I have a database where all access is controlled by stored procedures. The DBA would like to avoid giving users direct read/write access to the underlying tables, which I can understand. Hence all ...
Disturbing asked 28/9, 2010 at 19:54
1
Solved
SET @whereCond = @whereCond + ' AND name LIKE ''%'' + @name + ''%'''
Is there something wrong here? After I generate where condition, I execute it with sp_executesql, but I did get anything. When...
Ultan asked 24/8, 2010 at 12:43
1
© 2022 - 2024 — McMap. All rights reserved.