Simulating A SQL Cursor Task In I.S. 2005
Nov 21, 2006
Hi EveryBody,
I have the following question :
What components of I.S. would I use, for simulating a cursor in SQL like that?
Example of simple cursor :
declare c_CURSOR cursor FOR
SELECT DISTINCT V.CODIGO FROM GB_RELACIONAL.DBO.VISITA V INNER JOIN MEDIDAS_LINEAL_PROMOCION_200604_02 M
ON M.CODIGO_VISITA=V.CODIGO AND M.TIEMPO_ENTRE_vISITAS <> V.TIEMPO_ENTRE_VISITAS
OPEN C_CURSOR
FETCH NEXT FROM C_CURSOR INTO @CODIGO
WHILE @@FETCH_STATUS=0
Do various Jobs; Doing Selects, Inserts etc.. using @codigo
FETCH NEXT FROM C_CURSOR INTO @CODIGO
end
CLOSE C_CURSOR
DEALLOCATE C_CURSOR
Then what I need is passing the @codigo in every loop, to other components in I.S., for doing inserts in other related tables.
Then my questions are:
a- What Component i would use for simulating the looping cursor like the example ?
b- How i Store and pass de @codigo to the other I.S. components for doing the selects, inserts?
c- What I.S. components and how would use, for receiving the @codigo ,and doing the corresponding Select , Inserts.. in the related tables , using that variable ( @codigo ) ?
I need an Idea of the I.S. components, configurations, and the flow for doing something like this...
Thank in advance!!
View 4 Replies
ADVERTISEMENT
Oct 11, 2005
How could I create an allocation or consistency error (or otherwise corrupt a db) in a database to test a backup and restore system?
View 3 Replies
View Related
Feb 24, 2007
Hi,
Can anybody let me know if there are ways to programatically track changes made to a SQL SERVER CE table? I am writing a db monitoring tool on SQL server CE which should track any changes made to the table.(Insert update and delete)
We could have done this using triggers on Sql Server 2005. Since triggers are not supported on SQL Server CE, are there any alternate ways to achieve this functionality?
Regards,
Ananth
View 3 Replies
View Related
Apr 22, 2004
Folks,
I have a an sql table having 10,000 Rows.
The table has 5 columns. They are S1,S2,S3,S4 and M
I need the best way to calculate the MEDIAN for each row and store it in M. i.e. M=median(S1,S2,S3,S4)
I've come across articles where they've calculated medians on table rows, not table columns. But my requirement involves table columns. I guess transposing the columns into rows and then calculating median should be possible, but if I do that for 10000 rows using a cursor, then it would take a loooooong time.
Please suggest the best way to counter this
Thanx
Kiran
View 1 Replies
View Related
Aug 27, 2007
Hello
Can anybody help me out in
1) implementing cursors in SSIS. I want to process each row at a time from a dataset. I was trying to use Foreachloop container but in vain. Can you please answer in detail.
my few other questions are:
1) Can i do nested inner join in SSIS. If yes, how? ( I have three table i need to join Tab1 to table 2 and get join the table 3 to get the respective data)
2) I have a resultsets. I want to split the data according to data in a col.
Say for instance:
Col1 Col2
A 1
A 2
B 3
C 4
C 5
i want to split the data according A, B and C . i.e., if Col1= A then do this, if Col1= B then do this..etc. How can i do this using conditional split task in SSIS
View 6 Replies
View Related
Nov 7, 2007
A common issue that I run across with clients is they want only want to process a file if it's finished transmitting to the server. This SQL Server 2005 task reads the properties of a file and writes the values to a series of variables. For example, you can use this task to determine if the file is in use (still be uploaded or written to) and then conditionally run the Data Flow task to load the file if it's not being used. You can also use it to determine when the file was created in order to determine if it must be archived.
http://www.pragmaticworks.com/filepropertiestask.htm
View 5 Replies
View Related
Jan 29, 2008
I am not fimilar with cursors at all but need some assistance/direction on how to re-create the following.
The result set will need to give me a list of new customers with sign dates of last year and this current year plus their sales for each year. If the customer has a date signed of 2007 I need to see the "year of sales" for both 2007 and 2008, whether or not they actually had sales.
I'm needing to convert an oracle cursor to Sql Server 2005. If at all possible I would like to stay away from the cursor and create this some other way. Any help would be greatly appreciated.
Customer Date Signed Year of Sale Amount
1111 7/1/07 2007 $50,000.0
2008 0.0
Below is the oracle cursor that was used to calculate this information in the past.
DECLARE
MBLDRN BAV_BUILDER_NEW.BLDRN%TYPE;
MYR_SIGNED BAV_BUILDER_NEW.YEAR%TYPE;
MCOMPANY BAV_BUILDER_NEW.COMPANY%TYPE;
MSHORTNAME BAV_BUILDER_NEW.SHORTNAME%TYPE;
MDSIGNED BAV_BUILDER_NEW.DSIGNED%TYPE;
MDCANCELED BAV_BUILDER_NEW.DCANCELED%TYPE;
MDMTERR BAV_BUILDER_NEW.DMTERR%TYPE;
MDMNAME BAV_BUILDER_NEW.DMNAME%TYPE;
MENGR_TEAM BAV_BUILDER_NEW.ENGR_TEAM%TYPE;
MSALESREGON BAV_BUILDER_NEW.SALESREGON%TYPE;
MDIVCODE BAV_BUILDER_NEW.DIVCODE%TYPE;
MYRLOOP NUMBER;
MLSTYR NUMBER;
MSYEAR DATE;
MEYEAR DATE;
CURSOR CA IS SELECT YEAR,BLDRN,COMPANY,SHORTNAME,DSIGNED,DCANCELED,
DMTERR,DMNAME,ENGR_TEAM,SALESREGON,DIVCODE
FROM BAV_BUILDER_NEW
ORDER BY YEAR;
BEGIN
SELECT YEAR INTO MLSTYR FROM CURRENT_DATES;
OPEN CA;
LOOP
FETCH CA INTO MYR_SIGNED,MBLDRN,MCOMPANY,MSHORTNAME,MDSIGNED,MDCANCELED,
MDMTERR,MDMNAME,MENGR_TEAM,MSALESREGON,MDIVCODE;
EXIT WHEN CA%NOTFOUND;
MYRLOOP := MYR_SIGNED;
WHILE MYRLOOP <= MLSTYR LOOP
SELECT MIN(SYEAR) INTO MSYEAR FROM UDBDATES WHERE YEAR=MYRLOOP;
SELECT MAX(EYEAR) INTO MEYEAR FROM UDBDATES WHERE YEAR=MYRLOOP;
BEGIN
INSERT INTO BAV_BUILDER_NEW_DATA (YR_SIGNED,DIVCODE,SALESREGON,
BLDRN,COMPANY,SHORTNAME,DSIGNED,DCANCELED,ENGR_TEAM,
DMTERR,DMNAME,YR_SALES)
VALUES
(MYR_SIGNED,MDIVCODE,MSALESREGON,MBLDRN,MCOMPANY,MSHORTNAME,
MDSIGNED,MDCANCELED,MENGR_TEAM,MDMTERR,
MDMNAME,MYRLOOP);
END;
MYRLOOP := MYRLOOP + 1;
END LOOP;
COMMIT WORK;
END LOOP;
COMMIT WORK;
CLOSE CA;
END;
/
COMMIT WORK;
View 8 Replies
View Related
Aug 6, 2007
Please advice when i used loop in the below code its only returning last value from the sub table however i wanted to fetch all values from the sub-table----
Please advice..
ALTER Procedure [dbo].[SyncEmpContGrid] @EmpID As Varchar(20)
As
Declare @CountryEOF bit,
@i int,
@CtR Varchar (1000)
begin
Declare @C_list Cursor
Declare ContCr Cursor Local for
(Select custCountryofExperience from Employees_CountryExperience where Employee=@EmpID)
Set @C_List = contCr
Open @C_List
Fetch next from @C_List into @CtR
While (@@Fetch_Status = 0 )
Begin
set @ctR = @ctR + ','
Fetch next from @C_List into @CtR
update EmployeeCustomTabFields
Set custTxt_Ct = @CtR Where (EmployeeCustomTabFields.Employee = @EmpID);
end
Close @C_List
Deallocate @C_List
Deallocate ContCr
end
View 4 Replies
View Related
Jun 18, 2007
HelloI have a VB6 application using classic ado (MDAC 2.8) for connectingms sql 2000 server. Application uses a lot of server side cursors. NowI want to switch to ms sql 2005 server but I have noticed very seriousperformance problem. Sql profiler results of execution of followingcommands:declare @p1 intset @p1=180150131declare @p3 intset @p3=1declare @p4 intset @p4=16388declare @p5 intset @p5=22221exec sp_cursoropen @p1 output,N' Select ... from ... where .... orderby ...',@p3 output,@p4 output,@p5 outputselect @p1, @p3, @p4, @p5on sql server 2000:CPU: 234Reads:82515Writes:136Duration:296and on sql server 2005:CPU: 4703Reads:678751Writes:1Duration:4867Both databases are identical, the servers runs on the same machine(Pentium 2,8 Ghz, 2 GB RAM) with only one client connected. On forumsI've read that Microsoft doesn't recommend using server side cursorson sql 2005 but is there any way to increase performance to someacceptable level?thanks in advanceszymon strus
View 5 Replies
View Related
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
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
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
May 27, 2008
What is the best way of reliably closing a cursor inside a BEGIN CATCH block? The simple problem statement is: I want to check if the cursor is open, then close it. I'm trying to use CURSOR_STATUS function and it seems to return a -3 (both when the cursor is open and not open.). Is this a bug or am I missing something?
I have removed all of my code and only provided what is necessary to repro the problem.
====================================================================================================
CREATE PROCEDURE dbo.repro_PROC
(
@condition1 varchar(10),
@condition2 varchar(10)
)
AS
BEGIN
BEGIN TRY
SET NOCOUNT ON;
SET XACT_ABORT ON;
DECLARE @dbName varchar(64), @dbid int;
DECLARE @FileID int;
DECLARE @Physical_Name varchar(512);
IF (@condition1 = 'ERROR')
RAISERROR ('ERROR: This error happens before any cursor is declared or is open', 16, 1);
DECLARE dbNameCursor CURSOR FOR SELECT Name, database_id FROM master.sys.databases ORDER BY Name;
OPEN dbNameCursor;
FETCH NEXT FROM dbNameCursor INTO @dbName, @dbid;
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE fileCursor CURSOR FOR SELECT File_ID, Physical_Name FROM master.sys.master_files
WHERE database_id = @dbid
ORDER BY File_ID;
OPEN fileCursor;
FETCH NEXT FROM fileCursor INTO @FileID, @Physical_Name;
WHILE @@FETCH_STATUS = 0
BEGIN
-- some condition which causes an exception
IF (@condition2 = 'ERROR')
RAISERROR ('ERROR: This error happens after both cursors are open', 16, 1);
FETCH NEXT FROM fileCursor INTO @FileID, @Physical_Name;
END
CLOSE fileCursor;
DEALLOCATE fileCursor;
FETCH NEXT FROM dbNameCursor INTO @dbName, @dbid;
END
CLOSE dbNameCursor;
DEALLOCATE dbNameCursor;
END TRY
BEGIN CATCH
DECLARE @ErrorMessage NVARCHAR(4000);
DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
DECLARE @fileCursorStatus INT;
DECLARE @dbNameCursorStatus INT;
SELECT
@ErrorMessage = ERROR_MESSAGE(),
@ErrorSeverity = ERROR_SEVERITY(),
@ErrorState = ERROR_STATE();
SET @fileCursorStatus = CURSOR_STATUS('local', 'fileCursor');
SET @dbNameCursorStatus = CURSOR_STATUS('local', 'dbNameCursor');
PRINT 'Cursor_Status (fileCursor) = ' + convert(varchar, @fileCursorStatus);
PRINT 'Cursor_Status (dbNameCursor) = ' + convert(varchar, @dbNameCursorStatus);
IF (@fileCursorStatus >= 0)
BEGIN
PRINT 'Closing fileCursor';
CLOSE fileCursor;
DEALLOCATE fileCursor;
END
IF (@dbNameCursorStatus >= 0)
BEGIN
PRINT 'Closing dbNameCursor';
CLOSE dbNameCursor;
DEALLOCATE dbNameCursor;
END
-- info about the original error
RAISERROR (@ErrorMessage, -- Message text.
@ErrorSeverity, -- Severity.
@ErrorState -- State.
);
END CATCH;
END;
====================================================================================================
EXEC dbo.repro_PROC @condition1='ERROR', @condition2='NO-ERROR'
Output:
Cursor_Status (fileCursor) = -3
Cursor_Status (dbNameCursor) = -3
Msg 50000, Level 16, State 1, Procedure repro_PROC, Line 88
ERROR: This error happens before any cursor is declared or is open
-------------------------------------------------------------------------
EXEC dbo.repro_PROC @condition1='NO-ERROR', @condition2='ERROR'
Output:
Cursor_Status (fileCursor) = -3
Cursor_Status (dbNameCursor) = -3
Msg 50000, Level 16, State 1, Procedure repro_PROC, Line 89
ERROR: This error happens after both cursors are open
-------------------------------------------------------------------------
EXEC dbo.repro_PROC @condition1='NO-ERROR', @condition2='ERROR'
Output:
Cursor_Status (fileCursor) = -3
Cursor_Status (dbNameCursor) = -3
Msg 50000, Level 16, State 1, Procedure repro_PROC, Line 89
A cursor with the name 'dbNameCursor' already exists. <=== THIS IS A PROBLEM
=================================================================================================
If I try to close the cursor when the status = -3, then sometimes it closes successfully, some other times, it errors "Cursor NOT open" etc.
View 6 Replies
View Related
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
Jun 18, 2007
Hello
I have a VB6 application using classic ado (MDAC 2.8) for connecting ms sql 2000 server. Application uses a lot of server side cursors. Now I want to switch to ms sql 2005 server but I have noticed very serious performance problem. Sql profiler results of execution of following commands:
declare @p1 int
set @p1=180150131
declare @p3 int
set @p3=1
declare @p4 int
set @p4=16388
declare @p5 int
set @p5=22221
exec sp_cursoropen @p1 output,N' Select ... from ... where .... order by ...',@p3 output,@p4 output,@p5 output
select @p1, @p3, @p4, @p5
on sql server 2000:
CPU: 234
Reads: 82515
Writes: 136
Duration: 296
and on sql server 2005:
CPU: 4703
Reads: 678751
Writes: 1
Duration: 4867
Both databases are identical, the servers runs on the same machine (Pentium 2,8 Ghz, 2 GB RAM) with only one client connected. On forums I've read that Microsoft doesn't recommend using server side cursors on sql 2005 but is there any way to increase performance to some acceptable level?
thanks in advance
szymon strus
View 2 Replies
View Related
Jun 19, 2007
Hi
I have recently upgraded from SQL 2000 to SQL 2005 and I'm getting the following problem, can you suggest me if this is a issue with SQL 2005 or suggest me an asnwer for this.
Below is the exception from my log file
The cursor type/concurrency combination is not supported.
com.microsoft.sqlserver.jdbc.SQLServerException: The cursor type/concurrency combination is not supported.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.<init>(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.<init>(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStatement(Unknown Source)
The following is the piece of code where the problem I'm assuming is happening, how can I correct it.
varStmt1 = varConnection.prepareStatement(varCitationSQL.toString(),ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
Have tried using both JDC v1.1 and 1.2 but of no use.
View 5 Replies
View Related
Oct 19, 2006
Hi,
I was just wondering if anybody came across this behaviour where closing a Fast Forward Read only cursor takes abnormally long time to close. I am running SQL Server 2005 standard edition.
Thanks
Nand
View 1 Replies
View Related
Jun 21, 2007
OK. I give up and need help. Hopefully it's something minor ...
I have a dataflow which returns email addresses to a recordset.
I pass this recordset into a ForEachLoop configuring the enumerator as (Foreach ADO Enumerator). I also map the email address as a variable with index 0.
I then have a Execute SQL task which receives this email address as a varchar variable (parameter 0) which I then use in my SQL command to limit the rows returned. I have commented out the where clause and returned all rows regardless of email address to try to troubleshoot this problem. In either event, I then use a resultset to store the query result of type object and result name 0.
I then pass this resultset into a script variable to start parsing the sql rows returned as type object. ( I assume this is the correct way to do this from other prior posts ...).
The script appears to throw an exception at the following line. I assume it's because I'm either not passing in the values properly or the query doesn't return anything. However, I am certain the query works as it executes just fine at the command prompt.
Try
ds = CType(Dts.Variables("VP_EMAIL_RESULTS_RS").Value, DataSet)
My intent is to email the query results to each email address with the following type of data by passing the parsed data from the script to a send mail task. Email works fine and sends out messages but the content is empty. I pass the parsed data as string values to the messagesource and define the messagesourcetype as a variable in the mail task.
part number leadtime
x 5
y 9
....
Does anyone have any idea what I might be doing wrong?
thanks
John
View 5 Replies
View Related
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
Aug 23, 2006
I am trying to send a file to a ftp server but everytime the task executes it fails but doesn't tell why. The Connection succeeds when I test it. Any ideas what would cause this please let me know. The FTP server I'm trying to connect to is running on z/OS and has MvS operating system.
Thanks,
Mike
View 1 Replies
View Related
Oct 10, 2007
I'm currently using Windows Task Scheduler to run a few jobs. We would like to start using the SQL Server Agent to handle this. The problem I am having is in specifing the 'working directory' of the program. The program is generating some files in a temp directory withing the root of the application. For some reason when I schedule in SQL it is generating these files in the WinSys32 directory.
I am using the CmdExec type in my job step.
I am sure I may have left out some info. please let me know if you need anything else.
thanks.
View 7 Replies
View Related
Mar 21, 2006
Does not seem to copy over any db user permissions or role membership?
View 1 Replies
View Related
May 27, 2007
I have a strange problem that I think deals with security on SQL 2005.I have a scheduled task that runs on a Windows 2000 machine. It callsa vb script which creates a connection to SQL Server.We migrated a database from SQL 2000 to 2005 which is on a differentbox. I changed the connection in the vb script to use the new sqlserver. The original connection to SQL 2000 used the 'sa' accountcoded into the connection string , which we don't want to use on thenew server, so I changed the connection string in the script to usethe below login information.Const strConnection = "Provider=SQLOLEDB;DataSource=SQLServer;Integrated Security=SSPI;Persist SecurityInfo=False;Initial Catalog=database;I created a domain user and gave it dbo rights on the new database onSQL 2005 as well as administrative rights on the local machine and thenetwork. The task runs fine for a while and then it will fail tostart. I have looked in the event log as well as the SQL log and havenot found anything else that ran when my task failed. Once it hasfailed, if I manually run the vb script on the 2000 machine, it runsjust fine, but the schedule won't work. If I change the name of theuser that is running the scheduled task, it will begin working again.I have run the profiler on SQL 2005 and watched the scheduled tasklogin as the correct user and update the database. There is nopattern to when the scheduled task will stop running. This has beenhappening for a few days now.This script and scheduled task worked fine for over a year on themachine when it logged into SQL 2000 and nothing else has changed,which makes me think it is related to the SQL 2005 server. Any ideas?
View 1 Replies
View Related
Nov 15, 2007
I sure would like a quicker way to get to a script's code, then:
1. double-click
2. ctrl+tab to switch to script item in list
3. click on "Design Script" button.
I'm constantly editing scripts and I would LOVE to be able to right-click, "Design Script", bypassing the silly dialog. I've tried creating a macro with no success. While recording, when I click on "Design Script" from the dialog, it actually brings up the macro script in the editor. This task is frequent enough, that it deserves its own context menu entry.
Any ideas?
View 4 Replies
View Related
Mar 14, 2006
In one of my SSIS Project tasks I insert some records into a table. I want to somehow fire off an SSRS report and send this report to some staff members. how would I add a component to reference or run an SSRS report off the table I just inserted to all from SSIS? I assume I'd h ave to create the report in SSRS first, then somehow reference it from SSIS and then figure out a way to run the report, maybe export it into Excel format and send to the users....not sure how to go about all this in my SSIS package.
View 1 Replies
View Related
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
Oct 8, 2007
Hello! I would like to write a value from a column to a parameter in SSIS with the Execute SQL task. The problem is that I will never get a value for the parameter.
You can recreate the problem with the AdventureWorksDW sample database.
1. Drop an execute SQL task in the control flow
2. Set the connection to the AdventureWorksDw database
3. Write this in the SQL Statement box Select Max(FullDateAlterNateKey) as LastDate
From DimTime
4. Set the resultset to single Row
5. Under result set assign LastDate as the Result Name and create a parameter with a default date.
6. Execute the task, that will finish succesfully but the value of the parameter in 5 have not changed.
I have tried to change the scope to both the package level and the task level without any success. The value of the variable is still the default value. I have also tried a string variable without sucess.
Any ideas?
Kind Regards
Thomas Ivarsson
View 5 Replies
View Related
May 17, 2007
I have just installed Service Pack 2 on my SQL 2005 Standard Edition.
However, now all my SSIS packages will not allow me to open my Data FLow Tasks. I get the following error:
TITLE: Microsoft Visual Studio
------------------------------
Cannot show the editor for this task.
------------------------------
ADDITIONAL INFORMATION:
The task returned an unsupported control editor type. (Microsoft.DataTransformationServices.Design)
If I try to create a new Data Flow task I get:
TITLE: Microsoft Visual Studio
------------------------------
Failed to create the task.
------------------------------
ADDITIONAL INFORMATION:
The designer could not be initialized. (Microsoft.DataTransformationServices.Design)
I have tried to install the latest hotfixes after this but they had no effect.
Can anybody help me???? Please?
View 10 Replies
View Related
May 26, 2006
Hi
Does any body knows how to convert this VBScript Code to VBDotNet (SQL SERVER 2005 INTEGERATION). Below Codes Returns a list of all the services installed on a computer, and indicates their current status (typically, running or not running).Its in VBScript Format.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "
ootcimv2")
Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service")
For Each objService in colRunningServices
Wscript.Echo objService.DisplayName & VbTab & objService.State
Next
Regards
Deepu M.I
View 4 Replies
View Related
Mar 8, 2007
I set up a task to do a transfer of a SQL 2000 db to SQL 2005 in Integration Services (selected my servers, dbs, and chose DatabaseOnline method). In debug mode it processes for a little while and finally errors with:
[2] Progress: Starting database transfer.. Step 1 out of 2 complete
Error: The Execute method on the task returned error code 0x80131500 (An exception occurred while executing a Transact-SQL statement.). The Execute method must succeed, and indicate the result using an "out" parameter.
Task Transfer Database Task failed
Finished, 4:01:24 PM, Elapsed time: 00:10:39.422
View 2 Replies
View Related
Mar 24, 2008
I used the toolbox to select maintenance cleanup task to create the job to do this. In reading similar notes regarding this problem, some people mentioned that there was a choice to include subfolders. I do not have this choice. When I execute select @@version I get Microsoft SQL Server 2005 - 9.00.3042.00 (X64) Feb 10 2007 00:59:02 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2) . This is running on a cluster. Any idea what is going on here? Thanks.
View 6 Replies
View Related
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
Dec 21, 2007
hi,
i need execute a store procedure of Informix from sql server integration services.
i use driver IBM informix provider 3.2 and have linked server Informix and use sql task for execute the procedure
it's posible??
View 2 Replies
View Related