All Questions
Tagged with sql-server-2005 stored-procedures
787
questions
0
votes
0
answers
71
views
Stored procedure starting with #
I was running a trace on an application today and saw this for the first time ever, in the text data of the trace:
exec #spDMF1F848FB98D743F69BA4AF02A7C05927
Can't seem to find anything online ...
0
votes
1
answer
151
views
How to run CRUD in single procedure by using json?(T-SQL)
Procedure
ALTER PROCEDURE [dbo].[SpProductTsk]
(@json varchar(MAX))
AS
----insert---
BEGIN
DECLARE @SelectedProcedure varchar(max) = ''
IF @SelectedProcedure = 'SpProductIns'
...
0
votes
2
answers
160
views
Why the stored procedure is taking more than 50 seconds to retrive?
I have this procedure and it takes 50 seconds to fetch records.
Declare
@Emp int
Set @Emp= 0
SELECT DISTINCT tp.ProjectNo+' | '+tp.ProjectName as ProjectNo,
...
-1
votes
2
answers
3k
views
How to do loop in stored procedure for each row return by select statement [duplicate]
I have a 1 stored procedure in which i have used following query:
DECLARE @product_id int
select @product_id=id from rpidata where collection_id = 354
select @product_id
And it gives me only 1 last ...
1
vote
1
answer
623
views
Incorrect syntax error when trying to concat few values in declared variable which is output to SP
I am using SQL 2005
@empId is input parameter to SP which is INT.
Based on some logic, I am doing below in the IF ELSE statement, it throws error in OUTPUT line. basically I want to Concat. I tried ...
-1
votes
1
answer
1k
views
Sending the stored procedure output as comma-separated rather than multiple rows
I have a stored procedure that returns multiple rows with 5 columns:
SELECT Travel, ID, Dept, Role, Country
FROM TravelManager
For example, I get:
DName ID Dept Role Country
----------------...
-1
votes
1
answer
647
views
What is the equivalent of SQL Server 2005 IMAGE Datatype in C#
I have a stored procedure that I am calling in C# in data layer. So it has many parameters and one of which is bytes array
byte[] value
However, the column in the stored procedure and hence the ...
2
votes
2
answers
78
views
Creating a constraints on two Column combination MSSQL
I am having a table with two Column name Parent and Child having the data shown below.
| Parent | Child |
|---------------------|------------------|
| 100 | ...
4
votes
1
answer
17k
views
Stored Procedure using Recursive Query
I am writing a stored Procedure which should return me result and the same result will be passed as input to the stored Procedure and the recursion should stop after the input and output are same at ...
1
vote
1
answer
50
views
Create table 6 x 6 with automatic spill from upline
I am creating a code to company MMN. the idea is a system which has a table 6 x 6 with automatic spill.
For example.
I register 6 new persons.
John
Peter
Mary
Lary
Anderson
Paul
When I register my ...
-1
votes
1
answer
84
views
Stored Procedure works fine except insert statement
I am trying to perform few insert and updates in a stored procedure but it isn't working accordingly. Everything works fine except insert statements. I am unable to figure out the problem.
My stored ...
2
votes
2
answers
4k
views
How to insert multiple rows in a single query using a stored procedure in SQL Server
CREATE PROCEDURE Usp_insertgender
(@gendervalues VARCHAR(MAX))
AS
BEGIN
INSERT INTO sparsha.dbo.Genders ([GenderName])
VALUES @gendervalues;
END
I tried above procedure but I am getting ...
0
votes
1
answer
109
views
SQL 2005: Optimize upsert-like Stored Procedure using Cursor, possible?
Ok So this is the second time i'm trying to fix this.
I was wondering if there is a possible way to optimize the cursor created for a stored procedure, used to iterate through a big select statement ...
0
votes
1
answer
437
views
Pass a table variable from one stored procedure to another
I'm working on a SQL Server 2005 database and I'm trying to pass a table variable from one stored procedure to another. Below is the structure of the table and my attempt.
@MyTable
EmployeeID ...
0
votes
0
answers
320
views
How to get the returnvalue from stored procedure which uses GetStoredProcCommand with an object array of parameters
I have an SP below which returns either 1 or 2. This is good.
IF EXISTS(select 1 from Emp where empId = @empId)
return 1
ELSE
return 2
In the test code, I can do like below and get the ...