DataSource Controls :: Using Table Variable In Stored Procedure?

Feb 18, 2010

I've written a stored procedure which uses a table variable. The stored procedure is shown below:

[Code]....

The table variable @CaseNumbers is declared, and is a bunch of values are inserted using a table-valued function called SplitStringIntoInts. At this point I can select from @CaseNumbers and this works fine.But when I try to join onto @CaseNumbers, the name '@CaseNumbers' in the ON clause is highlighted with the error 'Must declare scalar variable @CaseNumbers'. What?! It's not scalar, I declared it ages ago and I have used it since!

View 3 Replies


Similar Messages:

DataSource Controls :: How To Use A Local Variable In Stored Procedure

Jan 18, 2010

I've created a SQL stored proc and want to change it to use a local variable to reduce process time..

Major lines of my SP:

[Code]....

I've been trying to use a variable for AVG(AA.Count) so that I don't have to process it three times,

[Code]....

=> this stored proc does not work, and I am not too sure where I should declare my local variable to use it in SELECT statement..

View 9 Replies

DataSource Controls :: Execute Stored Procedure Using A String Variable

Jun 22, 2010

Is it possible to save execute stored proc command in a string variable and then execute string variable?
Does this logic fits into LINQ2SQL? Why I want to do this - INstead of passing user control references to server, I want to save user control values to string in client side java script and then pass string to server to do actual stored proc execution. Hopefully this will improve performance.

View 3 Replies

DataSource Controls :: Assign Value To A Variable From Exec In A Stored Procedure?

Apr 21, 2010

I have this SPDECLARE @PERC VARCHAR(50)

DECLARE @nome_soc_repl VARCHAR(50)
set @PERC = '(select round((' + @nome_soc_repl + ' /(select sum ('+ @nome_soc_repl+ ') from exptot_perc))*100,2)
from exptot_perc)'
EXEC (@PERC)
nome_soc_repl is a varible that contains my table name

so I need to extrac the result of EXEC...for examples 15...... and put it on another variable.....

View 4 Replies

DataSource Controls :: How To Get A Single Value Out Of A Stored Procedure Recordset And Store It In A Variable

May 19, 2010

Here's a stored procedure I created that uses another stored procedure inside it to return a value:

[Code]....

Note the 'exec dirinfo.dbo.d_searchempbyname @TicketSubName' part. That stored procedure will return a single record. What I need is to get a single column from that recordset (in this case, the email address of the employee), and store that value in a variable.

View 3 Replies

SQL Server :: Table Variable As Parameter For Stored Procedure?

Sep 9, 2010

My stored procedure expects a uniqueidentifier as a parameter. However, this unique identifier is stored in a table variable, which looks like this:

DECLARE @GiftGuid uniqueidentifie

View 14 Replies

DataSource Controls :: How To Join Table In Stored Procedure Sql Server Db

Jun 9, 2010

my stored procedure is always extract some data into temp table such as"select name,address,content into #TEMP1 from table1,table2,table3"
finally, select another table together with #TEMP1 to extract all desire data from one queryselect T.name,T.address,T.content,C.other from #TEMP1 T, otherTable C
where T.ID=C.IDI would like to ask if i want to join one more table T2 into final query with "otherTable left C outer join on C.ID=T2.ID"

View 1 Replies

DataSource Controls :: When Use ##Temp Table In Stored Procedure, It Gives An Error?

Jun 15, 2010

i m using ##Temp Table in stored procedure..it gives this error There is already an object named '##people' in the database.in two codition1.in case of multisession2. if transaction drop in between even i drop Table in Last in stored procedure..what can i use in place of temp table to hold data for a time being

View 1 Replies

DataSource Controls :: Stored Procedure Does Not Indicate Table Returned In Dataset?

Apr 23, 2010

This may not be the correct place to put this as it is both a stored procedure AND Visual Studio 2008 problem.

I have the following stored procedure:

[Code]....

I have been mokeying around with it because of what is happening. I have a dataset, call it dataset1. I drag this stored procedure onto the dataset. I EXPECT a datatable to appear, instead the data set adds this store procedure to the queries table adapter and sets the exec mode to 'NonQuery' which unless I am very mistaken, means "don't expect a dataset back from this' when in fact you DO expect a dataset back from this.

The SQL server is a Windows 2000 Server running SQL 2000. It has never caused us a moments grief since we set it up oh-so-many years ago.

If I connect to a different database and drag a query into the same dataset I get a datatable as I expect. I cannot see where / how this procedure could be wrong. The query when executed returns exactly the data I expect, in the format I expect (looks like a table, acts like a table in the Query analyzer).

View 3 Replies

DataSource Controls :: Insert ID Field Into SQL Table Programatically From Stored Procedure?

Oct 6, 2010

I have a table in SQL where I insert data (CatCodes) using C# code but I want to insert ID code (DealerID) with it as well. Following is my Stored Procedure and C# code:

[Code]....

C#:

[Code]....

As you can see, I am insering CatCode values in Categories table using string cbspecialities.

How can I insert DealerID the same way? DealerID is automatically generated in tblDealers table when "InsertExternalInfo" asp.SqlDataSource control runs "InfoInsert" SP.

[Code]....

View 2 Replies

DataSource Controls :: Eliminate Returning Of Empty Table From Stored Procedure

Jul 12, 2010

I have a Procedure which should return only 1 Record on selecting record according to Priority.

BEGIN
DECLARE @Accounts nvarchar(MAX)
SELECT @Accounts = ISNULL([map_user_modules].[Accounts], '') FROM [map_user_modules]
WHERE [map_user_modules].[id_user] = 231 AND [map_user_modules].[id_module] = 5
IF ((@Accounts = '') OR (@Accounts = 'All'))
SELECT @Accounts = null

BEGIN
Select @@ROWCOUNT as Priority2
END
IF @@ROWCOUNT = 1
BEGIN
Return
END

BEGIN
Select @@ROWCOUNT as Priority3
END
IF @@ROWCOUNT = 1
BEGIN
Return
END

BEGIN
Select @@ROWCOUNT as Priority4
END
IF @@ROWCOUNT = 1
BEGIN
Return
END

In the above statement Suppose we take a scenario where Select @@ROWCOUNT as Priority3 is executed, I get two tables returned, One is the Table returned by Select @@ROWCOUNT as Priority3 and the other is the Table returned by Select @@ROWCOUNT as Priority2 which has no Records. How can I eliminate the Empty table that returns no records.

View 1 Replies

DataSource Controls :: Get The @@Identity From A Table By Using A Stored Procedure Called By Website

Jul 10, 2010

I am trying to get the @@Identity from a table by using a stored procedure called by my asp.net website. I am using a datareader to do this but get an error as it tells me it cannot convert the returned value to getint. Here is my code. What should I be using instead of getint?

Dim myReader = cmd.ExecuteReader()
While (myReader.Read())
intID = myReader.GetInt32(0)
End While
myReader.Close()

View 3 Replies

DataSource Controls :: Create A Stored Procedure That Displays Data From A Table?

Mar 22, 2010

More specifically, i'm trying to create a stored procedure that displays data from a table if the date column in the table matches a specific day of the week. (IE. Monday, Tuesday, ect...)

The date in my table is stored as MM/DD/YYYY.

View 5 Replies

DataSource Controls :: Stored Procedure For Delete Records From Parent And Child Table

Jan 16, 2010

I have two tables dept and employees those table have parent and child relation ship link column is deptno i want to delte department even this departmetn contains employees i want to write storedprocedure for first delte employees and after department if i wrtie these two querys in storedprocedure will i get any problems

Begin
Delete from tbl_employees where Department_Id=@Department_Id
Delete from tbl_Department where Department_Id=@Department_Id
RETURN
END

View 5 Replies

DataSource Controls :: How To Convert The Oracle Stored Procedure To Sqlserver 2005 Stored Procedure

Apr 2, 2010

This is surareddy. i nead some small clarification in the "Stored Procedure"

how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.

right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.

how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure

View 4 Replies

DataSource Controls :: Do Not Use Or Call Any Stored Procedure But It Says "Could Not Find Stored Procedure 'xxxxx'?

Dec 9, 2010

Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?

View 4 Replies

DataSource Controls :: Execute A Stored Procedure Within A Stored Procedure?

Jan 18, 2010

Does anybody if it is possible that a stored procedure returns rows which is the result of the execution of another sp? Something like..

[Code]....

View 11 Replies

DataSource Controls :: How To Call A Stored Procedure In Another Stored Procedure

May 13, 2010

i want to return output parameter from 1 storeprocedure. into another stored procedure.

View 7 Replies

DataSource Controls :: What Is Better: Connecting To DB With One Stored Procedure To Get Two Table At Once OR Connecting...

May 20, 2010

While working with LINQ to ENTITIES I see that there is only a way to use stored procedure that is returning one entity only, or a view that is a join of two entities.

But what if I need in ASPX page to get two tables that there is NO connection between them, no join can be done between them at all.

I have one Stored Procedure that return the two tables, but entities don't support this right now.

I can split them to two Stored Procedure and call each of them separately.

View 2 Replies

DataSource Controls :: Call One Stored Procedure In Another Procedure For Search?

May 1, 2010

I want to apply other stored procedure select query on result of first stored procedure.

View 1 Replies

DataSource Controls :: Stored Procedures Are Not Showing Up Correctly In The Stored Procedure Drop Down

Apr 27, 2010

I am using Visual Studio 2008 and SQL Server 2008 and have added a SQL datasource to my form.

When I configure the datasource, I choose my connection string which looks like this in my webconfig:

<connectionStrings>

<add
name="PSFSPRD_ConnectionString"
connectionString="Data

The database I am using has a schema called EQB and as such, my stored procedures are named as EQB.usp_SelectFunds, EQB.usp_SelectAccount, etc.

On the select tab of the Configure Data Source screen, I choose to use a stored procedure. The dropdown shows my stored procedures, however, the schema name does not show up in front of the stored procedures in the drop down. I see only usp_SelectFunds, usp_SelectAccount, etc.

I select one of the stored procedures and when I click TEST, I get the message that the stored procedure is not found. If I instead choose to use a SQL statement instead on the configuration screen and enter EXEC EQB.usp_SelectFunds and click TEST, it works fine.

Why are my stored procedures not showing up correctly in the stored procedure drop down and how can I fix this?

View 3 Replies

ADO.NET :: Can Pass A Value For A Output Variable In A Stored Procedure

Sep 7, 2010

I am calling a stored procedure, that exists in a SQL Server 2005 database, using ADO.NET, in which I instantiate a sql command object.

The stored procedure has an ouput variable like '@packageCode VARCHAR(100) = NULL OUTPUT'.

Can I set it's value when creating the sql command object? Or I can never set a value for an output type variable in a stored procedure?

View 5 Replies

SQL Server :: Declaring Variable In Stored Procedure?

Feb 16, 2011

I have this procedure

[Code]....

I don't know what variable should be put in where clause for tblVisitor.visitorID because there's a variable that was already passed by an output identity parameter by a different stored procedure. What will I put in the where clause for visitor id?

View 3 Replies

DataSource Controls :: To Use Stored Procedure In .net

May 30, 2010

how to use stored procedure in asp.net for for manipulation form sql server (in details).

View 2 Replies

DataSource Controls :: Stored Procedure In .net?

Mar 31, 2010

parameters inside the stored procedure.How to write .

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved