Accessing Global Cursor

Mar 3, 2004

hi friends,

Here is the stored procedures that I used.

------------------------------------------------------------------------------------
create procedure globalCursor
AS
DECLARE abc CURSOR GLOBAL FOR
select * from sales
OPEN abc

create procedure globalCursorTest
AS
DECLARE @sdate datetime
DECLARE @sperson varchar(15)
DECLARE @sregion varchar(15)
DECLARE @sales int
EXECUTE globalCursor
FETCH NEXT FROM abc INTO @sdate, @sperson, @sregion, @sales
print @sdate
print @sperson
print @sregion
print @sales
------------------------------------------------------------------------------------

When I execute globalCursorTest using SQL Query Analyser, it says

------------------------------------------------------------------------------------
Server: Msg 16915, Level 16, State 1, Procedure globalCursor, Line 4
A cursor with the name 'abc' already exists.
Server: Msg 16905, Level 16, State 1, Procedure globalCursor, Line 5
The cursor is already open.
------------------------------------------------------------------------------------

how to solve this? or in other words, how to simply create the procedure in the database without executing it, as i can see the execution of the first procedure globalCursor causes this problem.

Jake

View 8 Replies


ADVERTISEMENT

Accessing SQL Server From Global.ASA

Sep 21, 2005

Hi

I have an application written in classic ASP which uses Windows Authentication in SQL Server.

This seems to work fine, except when we try to write to the database in Session_OnEnd in Global.ASA.

We don’t get an error and although logging is enabled in SQL Server, no failed logins are reported. Nevertheless, the database is not updated.

I’ve tried adding the IWAM_Servername user to SQL Server, but that hasn’t made any difference.

Has anyone any thoughts on how to rectify this? At the moment, both SQL Server and IIS are running on the same PC, but we need to find a solution when they are on different PCs as well.

View 3 Replies View Related

Accessing Global Temporary Table

Jan 29, 2001

We are trying to use a ## table (global temporary table) in Access or Excel thru a ODBC connection to tempdb. We are able to see the system tables, but not any ## tables. We are able to perform selects on the same ## table with the same userid and password in Query Analyzer. If we use sa or make the userid dbo we are able to see the ## tables, but I don't want to give these type of permissions.

Any help would be appreciated. Thanks in advance.

View 1 Replies View Related

Accessing Global Variables In SSIS Script Components

Feb 6, 2008

How do i access global variables in SSIS scripts ?

the Dts.variables("VarName").Value

should work but doesn't ?
do i need to reference the variable another way ?

View 3 Replies View Related

Dynamic Query, Local Cursor Variable And Global Cursors

Oct 3, 2006

Hi all.



I am stuck in a bit of a conundrum for quite a while now, and I hope someone here will help me figure this one out.



So, first things first: let me explain what I need to do. I am
designing a web application that will allow users to consult info
available in a SQL2000 database. The user will enter the search
criterea, and hopefully the web page will show matching results.



The problem is the results shown aren't available per se in the DB, I
need to process the data a bit. I decided to do so on the SQL Server
side, though the use of cursors. So, when a user defines his search
criteria, I run a stored procedure that begins by building a dynamic
sql query and creating a cursor for it. I used a global cursor in order
to do so. It looked something like this:



SET @sqlQuery = ... (build the dinamic sql query)

SET @cursorQuery = 'DECLARE myCursor CURSOR GLOBAL FAST_FORWARD FOR ' + @sqlQuery

EXEC @cursorQuery

OPEN myCursor

FETCH NEXT FROM myCursor INTO ...

CLOSE myCursor

DEALLOCATE myCursor



This works fine, if there's only one instance of the
stored procedure running at a time. Should another user connect to the
site and run a search while someone's at it, it'll fail due to the
atempt to create a cursor with the same name.



My first thought was to make the cursor name unique, which led me to:

...

SET @cursorName = 'myCursor' + @uniqueUserID

SET @cursorQuery = 'DECLARE '+ @cursorName + 'CURSOR FAST_FORWARD FOR ' + @sqlQuery

EXEC @cursorQuery

...



The problem with this is that I can't do a FETCH NEXT FROM @cursorName since
@cursorName is a char variable holding the cursor name, and not a
cursor variable. So to enforce this unique name method the only option
I have is to keep creating dynamic sql queries and exucting them. And
this makes the sp a bitch to develop and maintain, and I'm guessing it
doesn't make it very performant.



So I moved on to my second idea: local cursor variables. The problem with
this is that if I create a local cursor variable by executing a dynamic
query, I can't extract it from the EXEC (or sp_executesql) context, as
it offers no output variable.


I guess my concrete questions are:


Is it possible to execute a dynamic sql query and extract a (cursor) variable from it?Is it possible to populate a local cursor variable with a global cursor, by providing the global cursor's name?Can I create a local cursor variable for a dynamic sql query? How?



Anybody sees another way arround this?Thanks in advance,

Carlos

View 3 Replies View Related

Moving From 2000 To 2005: Issue Accessing Cursor Returned By Sp

Apr 28, 2006

I have a number of triggers that call a stored procedure that returns a cursor. The triggers then use the results of this cursor to do other actions.

My problem is that this works fine in SQL2000 but just won't work in SQL2005. When I try to access the results of the returned cursor, I get an error -2147217900 could not complete cursor operation because the set options have changed since the cursor was declared.

If I port the code contained in the sp into the trigger, it runs fine. But having to port over the sp's code defeats the whole concept of being able to re-use the sp.

Does anybody have any ideas of what could be going on?

I look forward to a quick response.

Dennis

View 8 Replies View Related

Transact SQL :: STATIC Defines A Cursor That Makes Temporary Copy Of Data To Be Used By Cursor

Aug 12, 2015

In MSDN file I read about static cursor

STATIC
Defines a cursor that makes a temporary copy of the data to be used by the cursor. All requests to the cursor are answered from this temporary table in
tempdb; therefore, modifications made to base tables are not reflected in the data returned by fetches made to this cursor, and this cursor does not allow modifications

It say's that modifications is not allowed in the static cursor. I have a  questions regarding that

Static Cursor
declare ll cursor global static
            for select  name, salary from ag
  open ll
             fetch from ll
 
              while @@FETCH_STATUS=0
               fetch from ll
                update ag set salary=200 where 1=1
 
   close ll
deallocate ll

In "AG" table, "SALARY" was 100 for all the entries. When I run the Cursor, it showed the salary value as "100" correctly.After the cursor was closed, I run the query select * from AG.But the result had updated to salary 200 as given in the cursor. file says  modifications is not allowed in the static cursor.But I am able to update the data using static cursor.

View 3 Replies View Related

Dynamic Cursor Versus Forward Only Cursor Gives Poor Performance

Jul 20, 2005

Hello,I have a test database with table A containing 10,000 rows and a tableB containing 100,000 rows. Rows in B are "children" of rows in A -each row in A has 10 related rows in B (ie. B has a foreign key to A).Using ODBC I am executing the following loop 10,000 times, expressedbelow in pseudo-code:"select * from A order by a_pk option (fast 1)""fetch from A result set""select * from B where where fk_to_a = 'xxx' order by b_pk option(fast 1)""fetch from B result set" repeated 10 timesIn the above psueod-code 'xxx' is the primary key of the current Arow. NOTE: it is not a mistake that we are repeatedly doing the Aquery and retrieving only the first row.When the queries use fast-forward-only cursors this takes about 2.5minutes. When the queries use dynamic cursors this takes about 1 hour.Does anyone know why the dynamic cursor is killing performance?Because of the SQL Server ODBC driver it is not possible to havenested/multiple fast-forward-only cursors, hence I need to exploreother alternatives.I can only assume that a different query plan is getting constructedfor the dynamic cursor case versus the fast forward only cursor, but Ihave no way of finding out what that query plan is.All help appreciated.Kevin

View 1 Replies View Related

Could Not Complete Cursor Operation Because The Set Options Have Changed Since The Cursor Was Declared.

Sep 20, 2007

I'm trying to implement a sp_MSforeachsp howvever when I call sp_MSforeach_worker
I get the following error can you please explain this problem to me so I can over come the issue.


Msg 16958, Level 16, State 3, Procedure sp_MSforeach_worker, Line 31

Could not complete cursor operation because the set options have changed since the cursor was declared.

Msg 16958, Level 16, State 3, Procedure sp_MSforeach_worker, Line 32

Could not complete cursor operation because the set options have changed since the cursor was declared.

Msg 16917, Level 16, State 1, Procedure sp_MSforeach_worker, Line 153

Cursor is not open.

here is the stored procedure:


Alter PROCEDURE [dbo].[sp_MSforeachsp]

@command1 nvarchar(2000)

, @replacechar nchar(1) = N'?'

, @command2 nvarchar(2000) = null

, @command3 nvarchar(2000) = null

, @whereand nvarchar(2000) = null

, @precommand nvarchar(2000) = null

, @postcommand nvarchar(2000) = null

AS

/* This procedure belongs in the "master" database so it is acessible to all databases */

/* This proc returns one or more rows for each stored procedure */

/* @precommand and @postcommand may be used to force a single result set via a temp table. */

declare @retval int

if (@precommand is not null) EXECUTE(@precommand)

/* Create the select */

EXECUTE(N'declare hCForEachTable cursor global for

SELECT QUOTENAME(SPECIFIC_SCHEMA)+''.''+QUOTENAME(ROUTINE_NAME)

FROM INFORMATION_SCHEMA.ROUTINES

WHERE ROUTINE_TYPE = ''PROCEDURE''

AND OBJECTPROPERTY(OBJECT_ID(QUOTENAME(SPECIFIC_SCHEMA)+''.''+QUOTENAME(ROUTINE_NAME)), ''IsMSShipped'') = 0 '

+ @whereand)

select @retval = @@error

if (@retval = 0)

EXECUTE @retval = [dbo].sp_MSforeach_worker @command1, @replacechar, @command2, @command3, 0

if (@retval = 0 and @postcommand is not null)

EXECUTE(@postcommand)

RETURN @retval



GO


example useage:


EXEC sp_MSforeachsp @command1="PRINT '?' GRANT EXECUTE ON ? TO [superuser]"

GO

View 7 Replies View Related

Join Cursor With Table Outside Of Cursor

Sep 25, 2007

part 1

Declare @SQLCMD varchar(5000)
DECLARE @DBNAME VARCHAR (5000)

DECLARE DBCur CURSOR FOR
SELECT U_OB_DB FROM [@OB_TB04_COMPDATA]

OPEN DBCur
FETCH NEXT FROM DBCur INTO @DBNAME


WHILE @@FETCH_STATUS = 0
BEGIN

SELECT @SQLCMD = 'SELECT T0.CARDCODE, T0.U_OB_TID AS TRANSID, T0.DOCNUM AS INV_NO, ' +
+ 'T0.DOCDATE AS INV_DATE, T0.DOCTOTAL AS INV_AMT, T0.U_OB_DONO AS DONO ' +
+ 'FROM ' + @DBNAME + '.dbo.OINV T0 WHERE T0.U_OB_TID IS NOT NULL'
EXEC(@SQLCMD)
PRINT @SQLCMD
FETCH NEXT FROM DBCur INTO @DBNAME

END

CLOSE DBCur
DEALLOCATE DBCur


Part 2

SELECT
T4.U_OB_PCOMP AS PARENTCOMP, T0.CARDCODE, T0.CARDNAME, ISNULL(T0.U_OB_TID,'') AS TRANSID, T0.DOCNUM AS SONO, T0.DOCDATE AS SODATE,
SUM(T1.QUANTITY) AS SOQTY, T0.DOCTOTAL - T0.TOTALEXPNS AS SO_AMT, T3.DOCNUM AS DONO, T3.DOCDATE AS DO_DATE,
SUM(T2.QUANTITY) AS DOQTY, T3.DOCTOTAL - T3.TOTALEXPNS AS DO_AMT
INTO #MAIN
FROM
ORDR T0
JOIN RDR1 T1 ON T0.DOCENTRY = T1.DOCENTRY
LEFT JOIN DLN1 T2 ON T1.DOCENTRY = T2.BASEENTRY AND T1.LINENUM = T2.BASELINE AND T2.BASETYPE = T0.OBJTYPE
LEFT JOIN ODLN T3 ON T2.DOCENTRY = T3.DOCENTRY
LEFT JOIN OCRD T4 ON T0.CARDCODE = T4.CARDCODE
WHERE ISNULL(T0.U_OB_TID,0) <> 0
GROUP BY T4.U_OB_PCOMP, T0.CARDCODE,T0.CARDNAME, T0.U_OB_TID, T0.DOCNUM, T0.DOCDATE, T3.DOCNUM, T3.DOCDATE, T0.DOCTOTAL, T3.DOCTOTAL, T3.TOTALEXPNS, T0.TOTALEXPNS


my question is,
how to join the part 1 n part 2?
is there posibility?

View 1 Replies View Related

Cursor Inside A Cursor

Oct 5, 2004

I'm new to cursors, and I'm not sure what's wrong with this code, it run for ever and when I stop it I get cursor open errors




declare Q cursor for
select systudentid from satrans


declare @id int

open Q
fetch next from Q into @id
while @@fetch_status = 0
begin

declare c cursor for

Select
b.ssn,
SaTrans.SyStudentID,
satrans.date,
satrans.type,
SaTrans.SyCampusID,
Amount = Case SaTrans.Type
When 'P' Then SaTrans.Amount * -1
When 'C' Then SaTrans.Amount * -1
Else SaTrans.Amount END

From SaTrans , systudent b where satrans.systudentid = b.systudentid

and satrans.systudentid = @id




declare @arbalance money, @type varchar, @ssn varchar, @amount money, @systudentid int, @transdate datetime, @sycampusid int, @before money

set @arbalance = 0
open c
fetch next from c into @ssn, @systudentid, @transdate, @type, @sycampusid, @amount

while @@fetch_status = 0
begin

set @arbalance = @arbalance + @amount
set @before = @arbalance -@amount

insert c2000_utility1..tempbalhistory1
select @systudentid systudentid, @sycampusid sycampusid, @transdate transdate, @amount amount, @type type, @arbalance Arbalance, @before BeforeBalance
where( convert (int,@amount) <= -50
or @amount * -1 > @before * .02)
and @type = 'P'




fetch next from c into @ssn, @systudentid, @transdate, @type, @sycampusid, @amount
end
close c
deallocate c
fetch next from Q into @id

end
close Q
deallocate Q


select * from c2000_utility1..tempbalhistory1
truncate table c2000_utility1..tempbalhistory1

View 1 Replies View Related

Client Side Cursor Vs Sever Side Cursor?

Jul 20, 2005

I having a difficult time here trying to figure out what to do here.I need a way to scroll through a recordset and display the resultswith both forward and backward movement on a web page(PHP usingADO/COM)..I know that if I use a client side cursor all the records get shovedto the client everytime that stored procedure is executed..if thisdatabase grows big wont that be an issue?..I know that I can set up a server side cursor that will only send therecord I need to the front end but..Ive been reading around and a lot of people have been saying never touse a server side cursor because of peformance issues.So i guess im weighing network performance needs with the client sidecursor vs server performance with the server side cursor..I am reallyconfused..which one should I use?-Jim

View 1 Replies View Related

Global SP

Feb 26, 2006

Is there a way to write a SP for all database.

e.g. I see that I can use sp_databases SP in all databases.

How do I write my own SP which will be available in all databases?

The SP that I have is in a particular database, I cannot use it in other databases unless I manually write it in that too. Can I avoid this?

Thanks

View 1 Replies View Related

Global Variable

Apr 23, 2007

Hi All,I tried to get a global variable in my task scritp by using "Dts.Variables("myVar").Value", every time I've got an errorThe element cannot be found in a collection. This error happens when you try to retrieve an element from a collection on a container during execution of the package and the element is not there. I've seen some examples online to get global varaibles in task script and all of them display the same code Any idea Franck 

View 1 Replies View Related

Global DB Connection

Feb 11, 2008

I would like to create a global DB connection.  I am going to be using this string throughout my program and want to be able to call the string that references my connection.
Thanks in advance.

View 1 Replies View Related

DTS Global Variables

Nov 10, 2004

Hello,

In the properties for a DTS package, I have a string variable. I need to execute an update statement based on this variable. I was going to use Execute SQL, but I didn't know now to get a value from the variables section.

I store the value there because I will be using dtsrun or the DTS library to execute the package, which I can change this value upon execution. How do I execute an update based on the value?

Brian

View 3 Replies View Related

SQL Global Variable

Apr 19, 2001

How to create my own global variable and set its value. In another word, i want to set the value of a variable in one sp and want another sp to see its value.

thanks

Michael

View 2 Replies View Related

DTS Global Variables

Aug 6, 2001

Have anyone encountered a problem with DTS Global variables. What I am trying to do is keep a counter in a global variable. It works fine when I run the job manually but if I schedule the job it doesn't increment the counter. Any ideas?

Thanks in advance!
Nancy

View 1 Replies View Related

Global Variable

Feb 20, 2003

Is there a way to declare a global variable that can be used in seperate stored procedures?

I have a statistics table that tracks the inserts and updates for several stored procedures.

I need to have the procedure_A run and insert a count of inserted and updated rows.

Procedure_B needs to identify the row inserted by procedure_A and update the columns with a count of how many it inserted and updated.

Procedure_C needs to do the same as procedure_b.

I want to pass a global variable with the id of the row inserted by procedure_A to the rest of the procedures so that they will know which row to update. How do I do this? Can I?


Thanks.

View 3 Replies View Related

Global Variables

May 10, 2004

cani define a global time in sql server2000, which all tables in DIFFERENT databases can use. I need this in order to INNER JOIN all tables in SAME/DIFFERENT DBs on basis of this datetime field.

View 7 Replies View Related

Global Variable

May 27, 1999

Hi all,
I have a user using this tool, which creates a temporrary storeproc in tempdb.
when I don't give him permission on temp_db, it errors out and says you should create a system variable to point to a different database to create this sp.

Can anyone kindly explain to me how could this be done?
I appreciate any comment on this thread.

Thanks in advance.
Jay

View 1 Replies View Related

Global Variable

Aug 22, 2006

Dear All!

I want to know that how can i declare a global variable in database, assign some value to it, then using it in multiple triggers and procedure then deallocating that.

Please provide a smal example.

Regards,
Shabber.

View 6 Replies View Related

Global Variables

Feb 17, 2004

Hi,

Is there a way to declare a persistent global variable in SQL Server?

I'd like my stored procs to fetch data in a different source depending on a debug (or development) variable.

For example, I'd like to be able to set a variable to either 0 or 1 (true or false) and have a static SP defined as:


IF @MYVARIABLE = 1
SELECT * FROM Openquery(Server1, 'SELECT * FROM Table1")
ELSE
SELECT * FROM Openquery(Server2, 'SELECT * FROM Table2')


What do you think? Since these SPs should be called a lot, I don't want to store the info in a table, I want it as a global variableso it will be as fast as possible.

Any other suggestions are also welcomed.

Thanks,

Skip.

View 3 Replies View Related

How To Make @str Global?

Jan 31, 2007

If following code, it is ok if I execute part1 and q1 together.
but if I try to execute Q2, I got error

Server: Msg 137, Level 15, State 2, Line 4
Must declare the variable '@str'.

I guess I have to execute part1 and Q2 at same time.

Is there a way to avoid that. I mean after I execute part1 @str will be kept in memory, and I can execut q2 without a problem? (like in SAS)
Thank

/* Part1*/
/* how to make @str global*/
declare @str nvarchar(20);
set @str='%subway%';

/*Q1*/
select *, case regionname when 'telesales' then 't' else 'o' end as rn
from dbo.RPT_ContractDetails
where businessname like @str

/* Q2*/
select contracttypename,regionname, count(*)as cou, sum(fundingamount)as Dollar
from dbo.RPT_ContractDetails
where businessname like @str
group by contracttypename,regionname

View 3 Replies View Related

Q: DTS And Global Variables

Jul 23, 2005

Using SQL2000, I have a DTS that takes data from MySQL to sqlserver, thecatch is I want to specify a specific range of dates.How to use a global variable? At the moment I manually changes the dates andjobs run on a daily basis.sample sql statement from Mysql connection:select *from Table1where date between '1/1/2004' and '6/30/2004'CHANGE TO:select *from Table1where date between @fromdate and @todateTIABob

View 1 Replies View Related

Global Update

Jul 20, 2005

Hi all, I need to update some data in a table, based on some criteria.In this case we are talking about the stamping of a price against a job.The update table holds the jobs, and the update_details table holds theactivities performed on each job and the cost for each activity. If ipull back this information using the following codeselect t1.reference,t1.update_id, t2.*from update t1, update_details t2where left(t1.reference,2) in ('EA','ND','SD','ST')and t1.update_id = t2.update_idI get something likeEA 1883 Act1 4.20EA 1883 Act2 3.00EA 1883 Act3 7.50EA 2444 Act1 4.20SD 5433 Act1 5.60I need to update the cost for everything pulled back using the abovesql, to a price determined in another table (activities)the activities table would look something likeActivity_Code Cost_London Cost_RocAct1 5.60 4.20Act2 4.00 3.00Act3 6.20 5.60in a nutshell i need to update the cost in the update details fromCost_roc to Cost_london for all activities for all jobs in the updatetable that have a referance starting with specific letters. The newprices need to be obtained from the activities table.Would be very gratefull for any help on this matterRegards,Ian Selby*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

Global Variable??

Nov 1, 2007

I have several stored procedures and UDFs that have code that convert between GMT timezone and other U.S. timezones.

for example,
to convert from GMT to CT I use this:
@dtmCentral = dateadd(hour, -5,@GMTdtm)


However, come Nov 4th after 2AM, when DST ends, I need to change this to
@dtmCentral = dateadd(hour, -6,@GMTdtm)


Assuming that I can store this -5 or -6 value in a global variable, I want to have a stored procedure that updates it when DST starts and ends.


Is there a better way of doing this other than the option of going through the entire calculations of figuring out whether it's DST or not each time ?

Thanks.

View 6 Replies View Related

Global Execution

Feb 5, 2007

hey there

Reporting services - page footer

I have got this off the ssw.com.au





Execution Time


="Execution Time: " +
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).TotalSeconds < 1, "0 seconds",
(
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours > 0, System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours & " hour(s), ", "") +
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes > 0, System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes & " minute(s), ", "") +
IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds > 0, System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds & " second(s)", ""))
)


and it is supposed to show like this

Execution time: 1 minute, 10 seconds

but all I get is

Execution Time: 0 Seconds on all reports

Can someone tell me what is wrong please?



jewel

View 3 Replies View Related

How To Declare Global Sqlcommands...

Jan 12, 2007

Hello guys! Is it possible to declare global sql commands and call it in a rowcommand_function?
Here's what I did...
  Dim p_s_syounin2 As New SqlCommand
Dim cnn As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("StrConn").ConnectionString)

Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

If (Session("syozokubu_id") = 20) And (Session("syozokuka_id") = 21) And ((Session("kaikyuu_id") = 23)) Then

p_s_syounin2.CommandText= ("UPDATE TE_shounin_zangyou SET p_s_syounin2=syain_hnm FROM TR_syainID WHERE syozokubu_id=20 AND syozokuka_id=21 AND kaikyuu_id=23")
'''' connection string is not placed here acc. to my research
End If

End Sub

Protected Sub my_gridview_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles my_gridview.RowCommand



If e.CommandName = "Approve" Then

cnn.Open()
p_s_syounin2.ExecuteNonQuery()

cnn.Close()

End If

End Sub




 
I get an error message that says " ExecuteNonQuery: Connection property has not been initialized. " 
 
Please help me.
 
Thanks guys.
 
Audrey

View 1 Replies View Related

Use System Global Variable

Dec 17, 2007

Hi,
Can we create our own system global variable using @@ in Sql server 2000?
If yes, can you please post in the sql code with it?
Alos, is the system global variables are kwywords in Sql or they can be updated?
 Thanks in Advance!!!
Shobana 
 

View 1 Replies View Related

Global Server Variables

Apr 1, 2004

Is there a way in SQL Server to setup Global Server Variables or Constants

We are working with an Off the Shelf Constituent Management application based on SQL Server. We can only read from the App's DB. So we setup another DB to run SP to access the data in the main DB. One problem we have is that there codes that the app DB uses that we need to reference as criteria in our SP. Example: Code for a phone type of email is 731. So if we want to pull email addresses we need to Select where PhoneType = 731. We found out that each time the main db is rebuilt those codes change. That means finding everytime we used that code and changing it.

It would be great to be able to set a global variable and use it anytime that code is needed.

Any ideas.

View 2 Replies View Related

Global Connection String?

May 12, 2004

A sample connection string is something like this....

"Server=sql.company.com;Database=myDatabase;Trusted_Connection=True;"

My question is, since the actual .com must go into the string, if you change host companies,
you will have to go through all pages and also change the connection string.

I know there must be a way to declare the string once in like the global.asax and then
refer each page to that string.

I've been hunting around for a sample on how to do this.

Anyone know a good link to refer to?

Thanks,

Zath

View 2 Replies View Related

Setting DTS Global Var From Another DTS Package

Oct 25, 1999

How can I set a global var in another DTS package from inside the one I'm excuting. An example would be that I have in package #1 an ID that gets assigned, and it executes package #2 which needs the ID from the previous package.

Thanks,

Todd

View 1 Replies View Related







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