Stored Procedure Versioning Using VSS

Jun 15, 2005

Anybody using this feature?How To Add SQL Server 2000 Stored Procedures to Visual SourceSafe by Using Visual Studio .NETany comments?

View 5 Replies


ADVERTISEMENT

Versioning SQL Server Stored Procedures With VSS?

Oct 19, 1999

Hi everyone,

Is versioning SQL Server 7.0 stored procedures with VSS possible? If so,
how? How are people versioning stored procedures out there?

Thanks in advance...
bth@prucka.com

View 1 Replies View Related

Calling A Stored Procedure Inside Another Stored Procedure (or Nested Stored Procedures)

Nov 1, 2007

Hi all - I'm trying to optimized my stored procedures to be a bit easier to maintain, and am sure this is possible, not am very unclear on the syntax to doing this correctly.  For example, I have a simple stored procedure that takes a string as a parameter, and returns its resolved index that corresponds to a record in my database. ie
exec dbo.DeriveStatusID 'Created'
returns an int value as 1
(performed by "SELECT statusID FROM statusList WHERE statusName= 'Created') 
but I also have a second stored procedure that needs to make reference to this procedure first, in order to resolve an id - ie:
exec dbo.AddProduct_Insert 'widget1'
which currently performs:SET @statusID = (SELECT statusID FROM statusList WHERE statusName='Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID)
I want to simply the insert to perform (in one sproc):
SET @statusID = EXEC deriveStatusID ('Created')INSERT INTO Products (productname, statusID) VALUES (''widget1', @statusID)
This works fine if I call this stored procedure in code first, then pass it to the second stored procedure, but NOT if it is reference in the second stored procedure directly (I end up with an empty value for @statusID in this example).
My actual "Insert" stored procedures are far more complicated, but I am working towards lightening the business logic in my application ( it shouldn't have to pre-vet the data prior to executing a valid insert). 
Hopefully this makes some sense - it doesn't seem right to me that this is impossible, and am fairly sure I'm just missing some simple syntax - can anyone assist?
 

View 1 Replies View Related

Calling A Stored Procedure From ADO.NET 2.0-VB 2005 Express: Working With SELECT Statements In The Stored Procedure-4 Errors?

Mar 3, 2008

Hi all,

I have 2 sets of sql code in my SQL Server Management Stidio Express (SSMSE):

(1) /////--spTopSixAnalytes.sql--///

USE ssmsExpressDB

GO

CREATE Procedure [dbo].[spTopSixAnalytes]

AS

SET ROWCOUNT 6

SELECT Labtests.Result AS TopSixAnalytes, LabTests.Unit, LabTests.AnalyteName

FROM LabTests

ORDER BY LabTests.Result DESC

GO


(2) /////--spTopSixAnalytesEXEC.sql--//////////////


USE ssmsExpressDB

GO
EXEC spTopSixAnalytes
GO

I executed them and got the following results in SSMSE:
TopSixAnalytes Unit AnalyteName
1 222.10 ug/Kg Acetone
2 220.30 ug/Kg Acetone
3 211.90 ug/Kg Acetone
4 140.30 ug/L Acetone
5 120.70 ug/L Acetone
6 90.70 ug/L Acetone
/////////////////////////////////////////////////////////////////////////////////////////////
Now, I try to use this Stored Procedure in my ADO.NET-VB 2005 Express programming:
//////////////////--spTopSixAnalytes.vb--///////////

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim sqlConnection As SqlConnection = New SqlConnection("Data Source = .SQLEXPRESS; Integrated Security = SSPI; Initial Catalog = ssmsExpressDB;")

Dim sqlDataAdapter As SqlDataAdapter = New SqlDataAdaptor("[spTopSixAnalytes]", sqlConnection)

sqlDataAdapter.SelectCommand.Command.Type = CommandType.StoredProcedure

'Pass the name of the DataSet through the overloaded contructor

'of the DataSet class.

Dim dataSet As DataSet ("ssmsExpressDB")

sqlConnection.Open()

sqlDataAdapter.Fill(DataSet)

sqlConnection.Close()

End Sub

End Class
///////////////////////////////////////////////////////////////////////////////////////////

I executed the above code and I got the following 4 errors:
Error #1: Type 'SqlConnection' is not defined (in Form1.vb)
Error #2: Type 'SqlDataAdapter' is not defined (in Form1.vb)
Error #3: Array bounds cannot appear in type specifiers (in Form1.vb)
Error #4: 'DataSet' is not a type and cannot be used as an expression (in Form1)

Please help and advise.

Thanks in advance,
Scott Chang

More Information for you to know:
I have the "ssmsExpressDB" database in the Database Expolorer of VB 2005 Express. But I do not know how to get the SqlConnection and the SqlDataAdapter into the Form1. I do not know how to get the Fill Method implemented properly.
I try to learn "Working with SELECT Statement in a Stored Procedure" for printing the 6 rows that are selected - they are not parameterized.




View 11 Replies View Related

Versioning

Jul 20, 2005

Dear friends,In the area of GIS (Geographic Information Systems) there is a featureknown as versioning (long transactions).This feature allows databases to maintain different versions of data,in a hierachycal structure, in order to do simulation (what if ...),historical snapshots, concurrent editing, etc.Each version can be reconciled with its parent version in any moment(merge-post changes).I have recently seen that Oracle supports this feature from version9i.I am very interested in knowing if SQL server will support thisfeature in future versions. Looking at SQL Server 2005 doc. I haven'tseen any related info.Thanks,Jerry

View 5 Replies View Related

DTS Versioning

Jun 12, 2007

I'm having problems to keep proper versioning control in place between the development and production environments. I'm running SQL2000 and we have hundreds of packages that runs daily. Some on shedules and some not.



Every time a package is saved, it creates a version in SQL Server. After development I want to be able to use something like "Visual Source Safe" and book the final version in that was moved into production. Something with a version number etc.



This is especially a problem if I want to roll back to a prior version of a package. I do not know which one of the 1000 versions to choose from that were created while developing the package.



Another problem is that I do not know if someone is working on a package if I want to work on it.



I can not run a search on all the packages to get a list of which tables/fields are used where to determine the impact of a program/database/design change that needs to be implemented.



Any suggestions would be helpfull.

View 1 Replies View Related

T-SQL (SS2K8) :: One Stored Procedure Return Data (select Statement) Into Another Stored Procedure

Nov 14, 2014

I am new to work on Sql server,

I have One Stored procedure Sp_Process1, it's returns no of columns dynamically.

Now the Question is i wanted to get the "Sp_Process1" procedure return data into Temporary table in another procedure or some thing.

View 1 Replies View Related

SQL Server 2014 :: Embed Parameter In Name Of Stored Procedure Called From Within Another Stored Procedure?

Jan 29, 2015

I have some code that I need to run every quarter. I have many that are similar to this one so I wanted to input two parameters rather than searching and replacing the values. I have another stored procedure that's executed from this one that I will also parameter-ize. The problem I'm having is in embedding a parameter in the name of the called procedure (exec statement at the end of the code). I tried it as I'm showing and it errored. I tried googling but I couldn't find anything related to this. Maybe I just don't have the right keywords. what is the syntax?

CREATE PROCEDURE [dbo].[runDMQ3_2014LDLComplete]
@QQ_YYYY char(7),
@YYYYQQ char(8)
AS
begin
SET NOCOUNT ON;
select [provider group],provider, NPI, [01-Total Patients with DM], [02-Total DM Patients with LDL],

[Code] ....

View 9 Replies View Related

Connect To Oracle Stored Procedure From SQL Server Stored Procedure...and Vice Versa.

Sep 19, 2006

I have a requirement to execute an Oracle procedure from within an SQL Server procedure and vice versa.

How do I do that? Articles, code samples, etc???

View 1 Replies View Related

Database Versioning

Jul 13, 2000

I have a big delimma. We are developing and application that requires parallel work to be done one different copies of databases at the same time. Then when one when group is done and ready to ship their bug fixes/features, the changes they make to the database and data have to be merge back into the baseline database.

Here's the specifics. 4 databases (that make up the product), 4 copies of the 4 database (one for each team).

I was thinking about using SQL DMO to attach to each database and comare each table's schema and data against the baseline (the current release) then scripting out the changes that were made.

Can someone give me some tips on how to maintain parallel database development and the merge process that can make this happen?

Thanks,
Kurt

View 3 Replies View Related

Row Versioning In SQL 2000?

Sep 15, 2006

I replicate (transactional replication) my data entry database to aread-only database. Both are SQL 2000+SP4. The web server reads theread-only database. At times, there will be lots of changes in the dataentry database, thus lots of replications to the read-only database. Iam concerned that the replication may lock the data in the read-onlydatabase, causing slow response to the web server.I would like to use row versioning so that the read-only database cansupply old data when the same row is being written by replication. Iread that row versioning is a feature in SQL 2005. Is there anyversioning capability in SQL 2000?Thanks

View 1 Replies View Related

Sdf Database Versioning

Feb 11, 2008



I have a question about how I should go about handling different database versions (schema changes) with my application. I am using an sdf database as a local data store (either on the .NET framework or Compact Framework).

I set it up so that the database file has the database schema, but no actual data, which is copied to the AppData folder if it isn't already there. The I load the database into the dataset, and can store data in the database with no problems.

What I want to figure out is what happens when I later decide to change the database schema. For example, say I add a column to a table. When I load the existing database into the dataset, I get an exception because the existing database doesn't have that column.

It seems that there should be some way to update the existing database so that it adds the column into the table, and sets the rows to just have NULL for that new column.

I am not sure if the TableAdapter or some other object should handle updating the existing database so it matches the latest dataset schema, or if I need to manually write SQL statements to modify the existing database.

Any help is appreciated.

Adam

View 2 Replies View Related

Report Versioning

Nov 16, 2007

I was wondering if anyone knows if there is a way to version a report, after changes have been made kind of like there is to an application. when changes are made to an app with a version # of say 4.0.1 you can changge to 4.0.1. Without using a program like SourceSafe. Thanks in advance for the speed responses.

View 5 Replies View Related

Database Versioning?

Sep 4, 2007

Hi,

Could someone point me in the right direction? I have an internal development database and a production database. Is there an easy way to replicate the changes that have been made to the development version on the production server without modifying the actual data in the tables? So, if I add a new user in my development version I offcourse don't want to see it pop up in the live version. But adding/deleting/updating a new table or column should.

And if possible I'd also like to know how you could do the following: Let's say we have an OrderDetail table containing information about the purchased product. Let's say I'd like to add a new column 'total' to skip calculation on the database every time I want to know the totals. It should be able to initialise the value by doing 'times ordered * price' for every existing row. Is that possible as well?


Srry for the noob questions

edit: Using MSSQL 2005

View 4 Replies View Related

Versioning - Deploy Just The Changes To The Server

Jan 8, 2008

At ScottGu's Blog about "Database Publishing Wizard", AlexD from codeplex said:
"Regarding the multiple requests for versioning, backup/restore of remote database, and selection of individual objects - these are all things we are actively looking at for our next release in the first half of 2007."
After so many searches, I still don't know if this tool performs Versioning, i.e, when deploying the database, just update de diferences between the local and server database.
Did Visual Studio Express 2008 have somethingh like that? (I know that VS Team Edition 2005 had).
If this tool can't make it (versioning), which tool/method did you recomend me?
Thanks in advance.
Alberto
 
 

View 1 Replies View Related

Versioning && History Question

Jun 22, 2005

I did a seach here and found some posts but none that answered my specific problem.I am a programmer tasked with building an application for generating Quote Proposals.  The database is for the most part fairly simple except when it comes to versioning and history.  Basiclly every quote can be revised and modified several times prior to making a final decision (final approved quote), so I need to keep track of the changes that occur durning the revision process.  I am not a DBA but I have had some database experience.  From what I can tell I have two choices a.) Duplicate all the data everytime the quote is revised.  While this method is does cause a lot of duplicate data it is very straitforward and easy to explain (or turnover to someone else) and reporting becomes very easy as well.Reporting....   this is my biggest area of concern as the users of the app should have the ability to print out the original quote proposals as well as the revised quote proposals.  Duplicating all the data makes reporting very easy.b.) Create a history table and record the original data (along with who and when) before recording the new value in the main table.  While this method does conserve disk space it make reporting a bit difficult as you would have to pull the specific value for a specific Quote Revision and display the orginal values on the report instead of the current ones.Table info:  I looking a 10 to 12 tables to record and store the data.  The largest table will have about 40 fields.  Current estimates are producing about 5 to 8 quotes per week.  Each quote is revised an average of 2 to 3 times.Are the pros and cons I listed the main ones to be concerned with and are there any other options?Thanks

View 1 Replies View Related

Service Pack Versioning

Mar 6, 2001

Does Anyone know if there is a way to verify the SQL Service Pack Version on 7.0? Thanks. Dallas

View 1 Replies View Related

Row Versioning, Audit, Best Practice

Mar 2, 2007

I have a small webapplication, sql server 2000. The users can only update the data in the system. However my client needs a report that display changes. The changes are that needs to be monitored are only change of order status, change of delivery date and when a user splits an order.

What is the best practice to keep track of changes? A mirror table for each table with changes?

/Magnus

View 3 Replies View Related

SSIS Versioning Control

Jun 7, 2006

Hi All,
I'm new on SSIS, but have worked for some time with DTS and a long time with other ETL tools like Informatica or OWB.

I would like to know in which way can i, easily, control my project/package versions. At the same time i need to implement a concurrency management system, which will control what developer is using which package, and when finished update the central repository (As it does Informatica or even OWB).

I have heard that i could implement versioning with source safe, but can i implement this in the way that i've referenced before. Can i use CVS?

Thanks,
VĂ­tor Ferreira

View 3 Replies View Related

Grab IDENTITY From Called Stored Procedure For Use In Second Stored Procedure In ASP.NET Page

Dec 28, 2005

I have a sub that passes values from my form to my stored procedure.  The stored procedure passes back an @@IDENTITY but I'm not sure how to grab that in my asp page and then pass that to my next called procedure from my aspx page.  Here's where I'm stuck:    Public Sub InsertOrder()        Conn.Open()        cmd = New SqlCommand("Add_NewOrder", Conn)        cmd.CommandType = CommandType.StoredProcedure        ' pass customer info to stored proc        cmd.Parameters.Add("@FirstName", txtFName.Text)        cmd.Parameters.Add("@LastName", txtLName.Text)        cmd.Parameters.Add("@AddressLine1", txtStreet.Text)        cmd.Parameters.Add("@CityID", dropdown_city.SelectedValue)        cmd.Parameters.Add("@Zip", intZip.Text)        cmd.Parameters.Add("@EmailPrefix", txtEmailPre.Text)        cmd.Parameters.Add("@EmailSuffix", txtEmailSuf.Text)        cmd.Parameters.Add("@PhoneAreaCode", txtPhoneArea.Text)        cmd.Parameters.Add("@PhonePrefix", txtPhonePre.Text)        cmd.Parameters.Add("@PhoneSuffix", txtPhoneSuf.Text)        ' pass order info to stored proc        cmd.Parameters.Add("@NumberOfPeopleID", dropdown_people.SelectedValue)        cmd.Parameters.Add("@BeanOptionID", dropdown_beans.SelectedValue)        cmd.Parameters.Add("@TortillaOptionID", dropdown_tortilla.SelectedValue)        'Session.Add("FirstName", txtFName.Text)        cmd.ExecuteNonQuery()        cmd = New SqlCommand("Add_EntreeItems", Conn)        cmd.CommandType = CommandType.StoredProcedure        cmd.Parameters.Add("@CateringOrderID", get identity from previous stored proc)   <-------------------------        Dim li As ListItem        Dim p As SqlParameter = cmd.Parameters.Add("@EntreeID", Data.SqlDbType.VarChar)        For Each li In chbxl_entrees.Items            If li.Selected Then                p.Value = li.Value                cmd.ExecuteNonQuery()            End If        Next        Conn.Close()I want to somehow grab the @CateringOrderID that was created as an end product of my first called stored procedure (Add_NewOrder)  and pass that to my second stored procedure (Add_EntreeItems)

View 9 Replies View Related

SQL Server 2012 :: Executing Dynamic Stored Procedure From A Stored Procedure?

Sep 26, 2014

I have a stored procedure and in that I will be calling a stored procedure. Now, based on the parameter value I will get stored procedure name to be executed. how to execute dynamic sp in a stored rocedure

at present it is like EXECUTE usp_print_list_full @ID, @TNumber, @ErrMsg OUTPUT

I want to do like EXECUTE @SpName @ID, @TNumber, @ErrMsg OUTPUT

View 3 Replies View Related

SQL Deployment / Production Package Versioning

Jan 10, 2006

For the past few months I've been developing an DW and ETL with SQL
2005 / SSIS.  My packages are being deployed to a SQL
Server.  Although in the end game we will have a
Dev/Staging/Production environments, I would still like to archive
production packages when we push staging to production. 
Essentially I would like to archive the last X packages that were
deployed to production where X is a reasonable number (3 - 5).  I
don't necessarily need to have them accessible to run.  One of the
purposes is to have another safeguard should we miss anything in user
testing and need to roll back a deployment.



I am utilizing VSS and we will have backups running on the production
server, but I would prefer to have a archive that is a little more
accessible.



I just wondering if anyone has any thoughts on how to extract/archive
production packages when the push is made.  I could easily develop
an app that queries the MSDB and exports the packages to the file
system. 



Anyone have any thoughts?



Larry Pope

View 2 Replies View Related

Suggested Best Practices For Custom Component Versioning

Oct 23, 2007

Edited:Maybe I should have posted this to the "managed" newsgroup. If any admins think that would be better, then let me know. I don't want to duplicate unnecessarily.

Hi,

We developed a custom Control Flow task for SSIS (2005, not yet had a lot of time to look at 2008 yet) and found that it does not handle versioning, or an uninstall and the resulting lack of an addressable component very gracefully.

Here is a typical scenario:

Baseline

Install component MyCustomTask 1.0
Create Project
Save Project

Action 1

Uninstall MyCustomTask 1.0 and don't install the new version (a typical user scenario!)
Open Project
SSIS acts like the world has ended, especially if the user forgot to manually remove the item from the toolbox
Fix:None, obviously, but it would be nice to be a bit more graceful and informative.
Backdoor Toolbox fix: "Cleanse" the toolbox when it goes haywire by deleting the toolbox.tbd, in Documents and Settings<UserName>Local SettingsApplication DataMicrosoftVisualStudio8.0

Action 2

Uninstall MyCustomTask 1.0 cleanly, plus removing the toolbox item by hand.
Install MyCustomTask 1.1, with identical interfaces etc, and add the toolbox item by hand.
SSIS acts like the world has ended, and fails to ask you a sensible question like "do you want to upgrade the project to use the new version of the component"
Fix:Identify major and minor version component changes and throw the user a rope.
Backdoor Fix: Go into the DTSX manually - attack the DTSExecutable ExecutableType and DTS Name, for a Task in our case and replace it with the new version info. Even if the interface for the component has changed slightly, it seems to deal with that OK.

Given the fact that it seems to be very likely that there will need to be SSIS version specific builds of components (I am assuming that a task created in 2005 will not work with 2008), what is the best way to deal with the current lack of SSIS smarts.

Would this be the best approach:

Version the interfaces, but never the builds within a version i.e. My.CustomTask90 v1.0, My.CustomTask100 v1.0 etc.

This is a bit of a pain, rather than the simpler My.CustomTask v9.0 / v10.0 etc.

Or, are there some nice improvements in the pipe to alleviate this, plus perhaps even a way to programatically add components to the toolbox, rather than the low-rent method of getting the user to do it by hand.

All suggestions gratefully received.


Thanks in advance

Gareth

View 6 Replies View Related

System Stored Procedure Call From Within My Database Stored Procedure

Mar 28, 2007

I have a stored procedure that calls a msdb stored procedure internally. I granted the login execute rights on the outer sproc but it still vomits when it tries to execute the inner. Says I don't have the privileges, which makes sense.

How can I grant permissions to a login to execute msdb.dbo.sp_update_schedule()? Or is there a way I can impersonate the sysadmin user for the call by using Execute As sysadmin some how?

Thanks in advance

View 9 Replies View Related

Ad Hoc Query Vs Stored Procedure Performance Vs DTS Execution Of Stored Procedure

Jan 23, 2008



Has anyone encountered cases in which a proc executed by DTS has the following behavior:
1) underperforms the same proc when executed in DTS as opposed to SQL Server Managemet Studio
2) underperforms an ad-hoc version of the same query (UPDATE) executed in SQL Server Managemet Studio

What could explain this?

Obviously,

All three scenarios are executed against the same database and hit the exact same tables and indices.

Query plans show that one step, a Clustered Index Seek, consumes most of the resources (57%) and for that the estimated rows = 1 and actual rows is 10 of 1000's time higher. (~ 23000).

The DTS execution effectively never finishes even after many hours (10+)
The Stored procedure execution will finish in 6 minutes (executed after the update ad-hoc query)
The Update ad-hoc query will finish in 2 minutes

View 1 Replies View Related

Design To Accomodate Entity Based Schema Versioning

Jul 20, 2005

in simple words it's about versioning at record level.ExampleTableEmployee - EmployeeId, EmployeeName,EmployeeAddress, DepartmentId,TableDesignationMap - EmployeeId, DesignationId, EffectiveDate,validityTableDepartment - DepartmentId, DepartmentTableDesignation - DesignationId, designationVia Modify-Employee-Details screen following are editableEmoyeeNameEmployeeAddressDepartmentDesignationthis screen should allow user to navigate through changes history.Example :Version -1EmoyeeName John SmithEmployeeAddress 60 NewYorkDepartment AccountsDesignation AccountantVersion -2EmoyeeName John SmithEmployeeAddress 60 NewYorkDepartment AccountsDesignation Chief Accountant - changedVersion -3EmoyeeName John SmithEmployeeAddress 60 NewYorkDepartment Sales - changedDesignation Marketing Manager - changedQuestion :What is the best proposed database design for maintaining historyrecords bound with version and retrieval techniqueBest RegardsSasanka

View 1 Replies View Related

Locking In Read Committed With Row Versioning Isolation Level

Dec 27, 2007

I have a question on locking pattern of read committed with snapshot isolation level that when two transaction update two different records then why do they block to each other even if they have previous committed value (old version of record).

I executed the below batch from a query window in SSMS

--Session 1:
use adventureworks
create table marbles (id int primary key, color char(5))
insert marbles values(1, 'Black')
insert marbles values(2, 'White')
alter database adventureworks set read_committed_snapshot on
set transaction isolation level read committed
begin tran
update marbles set color = 'Black' where color = 'White'

--commit tran

Before committing the first transaction I executed below query from second query window in SSMS

--Session 2:
use adventureworks
set transaction isolation level read committed
begin tran
update marbles set color = 'White' where color = 'Black'
commit tran


Here the first session blocks to second session. These same transactions execute simultaneuosly in snapshot isolation level. So my question is why this blocking is required in read committed with snapshot isolation level?

Thanks & Regards,
Subhash Chandra

View 1 Replies View Related

User 'Unknown User' Could Not Execute Stored Procedure - Debugging Stored Procedure Using Visual Studio .net

Sep 13, 2007

Hi all,



I am trying to debug stored procedure using visual studio. I right click on connection and checked 'Allow SQL/CLR debugging' .. the store procedure is not local and is on sql server.



Whenever I tried to right click stored procedure and select step into store procedure> i get following error



"User 'Unknown user' could not execute stored procedure 'master.dbo.sp_enable_sql_debug' on SQL server XXXXX. Click Help for more information"



I am not sure what needs to be done on sql server side



We tried to search for sp_enable_sql_debug but I could not find this stored procedure under master.

Some web page I came accross says that "I must have an administratorial rights to debug" but I am not sure what does that mean?



Please advise..

Thank You

View 3 Replies View Related

Is The Transaction Context Available Within A 'called' Stored Procedure For A Transaction That Was Started In Parent Stored Procedure?

Mar 31, 2008

I have  a stored procedure 'ChangeUser' in which there is a call to another stored procedure 'LogChange'. The transaction is started in 'ChangeUser'. and the last statement in the transaction is 'EXEC LogChange @p1, @p2'. My questions is if it would be correct to check in 'LogChange' the following about this transaction: 'IF @@trancount >0 BEGIN Rollback tran' END Else BEGIN Commit END.
 Any help on this would be appreciated.

View 1 Replies View Related

Calling Stored Procedure Fromanother Stored Procedure

Oct 10, 2006

Hi,I am getting error when I try to call a stored procedure from another. I would appreciate if someone could give some example.My first Stored Procedure has the following input output parameters:ALTER PROCEDURE dbo.FixedCharges @InvoiceNo int,@InvoiceDate smalldatetime,@TotalOut decimal(8,2) outputAS .... I have tried using the following statement to call it from another stored procedure within the same SQLExpress database. It is giving me error near CALL.CALL FixedCharges (@InvoiceNo,@InvoiceDate,@TotalOut )Many thanks in advanceJames

View 16 Replies View Related

Use Resultset Returned From A Stored Procedure In Another Stored Procedure

Nov 15, 2006

I have a store procedure (e.g. sp_FetchOpenItems) in which I would like to call an existing stored procedure (e.g. sp_FetchAnalysts). The stored proc, sp_FetchAnalysts returns a resultset of all analysts in the system.
I would like to call sp_FetchAnalysts from within sp_FetchOpenItems and insert the resultset from sp_FetchAnalysts into a local temporary table. Is this possible?
 Thanks,
Kevin

View 3 Replies View Related

SQL Stored Procedure Issue - Search Stored Procedure

May 18, 2007

This is the Stored Procedure below -> 
SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO
/****** Object:  Stored Procedure dbo.BPI_SearchArchivedBatches    Script Date: 5/18/2007 11:28:41 AM ******/if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BPI_SearchArchivedBatches]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[BPI_SearchArchivedBatches]GO
/****** Object:  Stored Procedure dbo.BPI_SearchArchivedBatches    Script Date: 4/3/2007 4:50:23 PM ******/
/****** Object:  Stored Procedure dbo.BPI_SearchArchivedBatches    Script Date: 4/2/2007 4:52:19 PM ******/
 
CREATE  PROCEDURE BPI_SearchArchivedBatches( @V_BatchStatus Varchar(30)= NULL, @V_BatchType VARCHAR(50) = NULL, @V_BatchID NUMERIC(9) = NULL, @V_UserID CHAR(8) = NULL, @V_FromDateTime DATETIME = '01/01/1900', @V_ToDateTime DATETIME = '01/01/3000', @SSS varchar(500) = null, @i_WildCardFlag INT)
AS
DECLARE @SQLString NVARCHAR(4000)DECLARE @ParmDefinition NVARCHAR (4000)
 
IF (@i_WildCardFlag=0)BEGIN
 SET @SQLString='SELECT       Batch.BatchID, Batch.Created_By, Batch.RequestSuccessfulRecord_Count, Batch.ResponseFailedRecord_Count,   Batch.RequestTotalRecord_Count, Batch.Request_Filename, Batch.Response_Filename, Batch.LastUpdated_By,   Batch.LastUpdated, Batch.Submitted_By, Batch.Submitted_On, Batch.CheckedOut_By, Batch.Checked_Out_Status,   Batch.Batch_Description, Batch.Status_Code, Batch.Created_On, Batch.Source, Batch.Archived_Status,  Batch.Archived_By, Batch.Archived_On, Batch.Processing_Mode, Batch.Batch_TemplateID, Batch.WindowID,Batch.WindowDetails,   BatchTemplate.Batch_Type, BatchTemplate.Batch_SubType  FROM           Batch  INNER JOIN   BatchTemplate ON Batch.Batch_TemplateID = BatchTemplate.Batch_TemplateID WHERE  ((@V_BatchID IS NULL) OR (Batch.BatchID = @V_BatchID )) AND  ((@V_UserID IS NULL) OR (Batch.Created_By = @V_UserID )) AND  ((Batch.Created_On >= @V_FromDateTime ) AND (Batch.Created_On <=  @V_ToDateTime )) AND  Batch.Archived_Status = 1 '
 if (@V_BatchStatus IS not null) begin  set @SQLString=@SQLString + ' AND   (Batch.Status_Code in ('+@V_BatchStatus+'))' end
 if (@V_BatchType IS not null) begin  set @SQLString=@SQLString + ' AND   (BatchTemplate.Batch_Type  in ('+@V_BatchType+'))' end END
ELSEBEGIN SET @SQLString='SELECT       Batch.BatchID, Batch.Created_By, Batch.RequestSuccessfulRecord_Count, Batch.ResponseFailedRecord_Count,   Batch.RequestTotalRecord_Count, Batch.Request_Filename, Batch.Response_Filename, Batch.LastUpdated_By,   Batch.LastUpdated, Batch.Submitted_By, Batch.Submitted_On, Batch.CheckedOut_By, Batch.Checked_Out_Status,   Batch.Batch_Description, Batch.Status_Code, Batch.Created_On, Batch.Source, Batch.Archived_Status,  Batch.Archived_By, Batch.Archived_On, Batch.Processing_Mode, Batch.Batch_TemplateID, Batch.WindowID,Batch.WindowDetails,   BatchTemplate.Batch_Type, BatchTemplate.Batch_SubType  FROM           Batch  INNER JOIN  BatchTemplate ON Batch.Batch_TemplateID = BatchTemplate.Batch_TemplateID WHERE  ((@V_BatchID IS NULL) OR (isnull (Batch.BatchID, '''') LIKE @SSS )) AND  ((@V_UserID IS NULL) OR (isnull (Batch.Created_By , '''') LIKE @V_UserID )) AND  ((Batch.Created_On >= @V_FromDateTime ) AND (Batch.Created_On <=  @V_ToDateTime )) AND  Batch.Archived_Status = 1 '
 if (@V_BatchStatus IS not null) begin  set @SQLString=@SQLString + ' AND   (Batch.Status_Code in ('+@V_BatchStatus+'))' end
 if (@V_BatchType IS not null) begin  set @SQLString=@SQLString + ' AND   (BatchTemplate.Batch_Type  in ('+@V_BatchType+'))' end
END
PRINT @SQLString
SET @ParmDefinition = N' @V_BatchStatus Varchar(30), @V_BatchType VARCHAR(50), @V_BatchID NUMERIC(9), @V_UserID CHAR(8), @V_FromDateTime DATETIME , @V_ToDateTime DATETIME, @SSS varchar(500)'
EXECUTE sp_executesql @SQLString, @ParmDefinition, @V_BatchStatus , @V_BatchType , @V_BatchID, @V_UserID , @V_FromDateTime , @V_ToDateTime , @SSS
GO
SET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO
 
 
The above stored procedure is related to a search screen where in User is able to search from a variety of fields that include userID (corresponding column Batch.Created_By) and batchID (corresponding column Batch.BatchID). The column UserID is a varchar whereas batchID is a numeric.
REQUIREMENT:
The stored procedure should cater to a typical search where any of the fields can be entered. meanwhile it also should be able to do a partial search on BatchID and UserID.
 
Please help me regarding the same.
 
Thanks in advance.
 
Sandeep Kumar
 

View 2 Replies View Related

Sql Count Using Stored Procedure Withing Stored Procedure

Apr 29, 2008

I have a stored procedure that among other things needs to get a total of hours worked. These hours are totaled by another stored procedure already. I would like to call the totaling stored procedure once for each user which required a loop sort of thing
for each user name in a temporary table (already done)
total = result from execute totaling stored procedure
Can you help with this
Thanks

View 10 Replies View Related







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