Checking Server Connection Before A For Each Loop

Apr 9, 2008

I have a list of servers on a table, I take this list and pass to a for each loop container and that will grab some system information from each server that we give for our internal auditors.

The issue that I'm currently having with this package is that some times, 1 or 2 servers from the list are down and/or extremelly busy and it times out, either case causes the whole package to fail.

What I'm trying to do is, test the connection to the server prior passing the server name to the For Each Loop Container and log that information somewhere (Maybe a boolean field in a table), so then I check after the package finish and validate that the server was actually up or down.

Any ideas or suggestions?

Thanks,
Igor Santos

View 8 Replies


ADVERTISEMENT

Checking If DB Connection Is Active Or Not

Aug 28, 2006

Hi,You all may be knowing that Connection.isClosed() does not tells usif the underying DB connection is active or not; it only checks ifConnection.close() had been previously called or not.One sure shot way to find out this is by executing some dummy SELECTquery and catching it via SQLException.This could be done in various DB's as follows:SELECT * from 1 (MS SQL)SELECT * from DUAL(Oracle)My question is what if you use some other DB , which is not famous asthe above.This could still be achieved by creating dummy table with one columnand querying it. One pitfall of doing this approach is we may not havecreate permissions to create table. Even if we have permissions tocreate table, you need to do the following, if you need to check DBConnection every time.a) Create Tableb) Use SELECT queryc) Drop tableYou may ask me why we need to use drop table. This is because, we cannot create many tables and keep them alive if we were to check (DBConn) it for 100 times. One way is we can use IF NOT EXISTS along withCreate table. Unfortunately, this command is not supported by all DBvendors. So, this is ruled out.One more way of doing is writing simple stored procedure that returnsplain constant. Unfortunatley the syntax for Stored procedures isdifferent for different DB Vendors.So, do we have a correct way of finding if DB connection is active,that would work on all DB's ?Fortunately, there is a way to do this.We could use Connection.getMetaData().getTables(null,null,null, null).We could use this way as this would surely get the number of tablespresent at that moment. How many tables are present in a DB will notbe cached as this may change dynamically. One disadvantage of usingthis approach is performance. What if a DB has 1000 tables, it tries toget the names of 1000 tables and it is performance hit.Is there a solution for this?. Yes, we can use getTables method byinvoking only against the SYSTEM table types. I am sure any DB willnot have many system tables.So, our call would be,Conn.getMetaData().getTables(null,null,null,new String[]{"SYSTEMTABLE"});The above statement is expected to give whether connection is active;if connection is not active, then it throws SQLException. And best partis it will work on all DB Drivers.What if some JDBC driver does not implement the above getTables() call,then we would get some AbstractMethodError that can be caught usingLinkageError. So, finally code for checking if connection is active ornot is as follows:try {ResultSet rs = conn.getMetaData().getTables(null,null,null,newString[]{"SYSTEM TABLE"});} catch (SQLException e) {conn.close();// use try catch block here to catch SQLException forConn.close();//call to open new DB connection.getNewConnection();}catch(LinkageError e){conn.close();// use try catch block here to catch SQLException forConn.close();//call to open new DB connection.getNewConnection();}}This limitation (if it can be called) is going to be fixed for JDBC4.0 implemented drivers(if they implement it in right way).Any comments on this would be appreciated.Regards,Venkata Narayana

View 2 Replies View Related

Checking For An Internet Connection

Dec 7, 2007

When using the Rda Pull/Push methods I need to have an Internet connection. I'm using VS2005 with VB to build my application. What commands can I use to check for and force or establish an internet connection from my pda?

View 1 Replies View Related

SQL Server 2008 :: Difference Between FOR LOOP And FOREACH LOOP?

May 28, 2010

difference between FOR LOOP and FOREACH LOOP with example(if possible) in SSIS.

View 4 Replies View Related

Losing Connection Mid-Way Through For-Each Loop

Apr 17, 2008

Hi - I am attempting to run an SSIS package through a SQL Agent job step. The package is fairly basic - I run some Execute SQL tasks, build an ADO recordset, enter into a For-Each loop, and perform some table updates based on the ADO recordset. So far so good. Approximately 1/3 of the records in my For-Each loop are processed, then I get a "Failed to acquire connection error". All I am doing for each iteration of the For-Each loop is updating one record in a table based upon the current value that is being processed from the ADO recordset. I am running the job on a 64-bit box, version 9.00.3050.00. I have also run this on two other 64-bit boxes (versions 9.00.1399.06 and 9.00.1406.00) and had the same issue. The owner of the Agent job is a sysadmin on the box. I don't understand why some items would be processed, then the connection drops mid-way through processing. What's even odder is the connection is dropped at the same point every time I run. The connection that I have defined in my package (I only have one connection defined in my package) is Provider type "Native OLEDBSQL Native Client", and I am using Windows authentication. The version of Visual Studio that I have developed this package in is 8.0.50727.42. Please help.

View 7 Replies View Related

Please Help! Dynamic DB Connection In Foreach Loop

Apr 4, 2006

Hello-

I'm trying to read a table that has database connection information for other DBs and use this within an "Execute SL Task" task. I have seen a number of posts that talk about this possibility, but I have not been able to get it to work yet.

When I've tried to set the connection to a variable (@[User::DB_ConnectionStr]) in the Expressions area of the SQL Task, the Connection type defaults to OLE DB and I can't seem to force it back to ADO or ADO.net.

I've tried doing this with the variable being set to both a connection object and a String with the connection string, but neither seems to work.

Any suggestions? Should this be a string value of the connection string? Am I missing something when trying to set the connection type?



Thanks much!

Tristan

View 3 Replies View Related

Opening And Closing A Connection In A Loop, Should I Or Shouldn't I?

Oct 31, 2006

i have a loop that can run say 30k times.  in there i am using the try / catch / finally blocks to handle ADO.NET Transactions (thanks CADDRE!)Should i open and close the SQL Connection for each record? or open it and close it outside of the loop only once ?thanks in advance, mcm  

View 3 Replies View Related

Script Component In Loop Tries To Evaluate Connection

May 12, 2006

I have a script component which loads a file which is in a custom format. The script component is inside a For Each Loop Container and it uses a flat file connection manager. The loop sets the connection string for the connection manager.

The problem I'm having is that the connection string needs to be set to something every time that I start the package but I don't know ahead of time what file there will be, so I get a System.IO.FileNotFoundException error on the script component. If I manually set the variable for the connection string and point it to a file that exists, then the package runs fine but at the end of the package the connection string is set to the last file loaded and this file will no longer exist the next time the package runs.

I hope this makes sense...

View 1 Replies View Related

Help- Problem With Foreach Loop And Excel Connection Manager

Nov 29, 2006



Hi,

I'm trying to write a package that imports a bunch of Excel files into a sql server table. My import routine works fine when I do not use a foreach loop container. I then add a Foreach Loop Container with a Foreach File Enumerator and create a variable to store all of the excel file names to use with my excel connection manager in the connection string property.



When I run the debugger I get the following error:



TITLE: Package Validation Error

------------------------------

Package Validation Error

------------------------------

ADDITIONAL INFORMATION:

Error at Import New Data [My Data (Excel) [4234]]: The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009.

Error at Import New Data [DTS.Pipeline]: component "My Data (Excel)" (4234) failed validation and returned error code 0xC020801C.

Error at Import New Data [DTS.Pipeline]: One or more component failed validation.

Error at Import New Data: There were errors during task validation.

Error at ImportMyData [Connection manager "Excel Connection Manager"]: An OLE DB error has occurred. Error code: 0x80040E4D.

(Microsoft.DataTransformationServices.VsIntegration)



I've read the varous posts on this forum and others with people having this problem and nothing that was recommended to them works for me. I've also read the Msdn article 'How to:Loop through Excel files and Tables' and followed the directions there without success. I've tried the following with no success:

I've tried to create first a hard coded connection string in the excel conn. manager which works but as soon as I set the experessions: connection string property = my file enumerator variable it breaks.

Turned the Delay Validation to True for the package as well as the task

Set the Connection string equal to not just the variable coming from the file enumerator but to the full connection string : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @[User::excel_filename] + ";Extended Properties="Excel 8.0;HDR=YES";"

I've also tried to set the excel filepath property instead of the connection string and this didn't work either.



I'm getting really frustrated. Any advice on why something so simple doesn't work for me would be appreciated.

Thanks



Anya

View 3 Replies View Related

Dts Package Foreach Loop Container And Excel Connection Manager

Sep 28, 2006

How can I use a foreach loop container with an Excel connection manager. It is virtually impossible to configure the ConectionString property through expressions builder. Everything works fine with a Flat File connection manager but when it comes to Excel, I get the following error message: Error 1 Validation error. Extract Four: Extract Four [1]: The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. Tarification.dtsx 0 0


Please ! Heeeelp ! tel me how I can loop through Excel files !

View 16 Replies View Related

Receiving Errors When Using Foreach Loop And Excel Connection Manager...

May 25, 2007

Purpose: Need to import excel source data into SQL Server 2005 tables. Excel source data comes in nulitple excel files with the same structure but different data. I would appreciate someone taking a look at the following information and notifying me of what I am doing incorrectly.

I Inserted a foreach loop container, a data flow task located inside the foreach loop contaiiner, an excel and SQL Server 2005 connections.

After trying multiple times I went the following URL and followed step by step direction on how to connect excel workbooks dynamically: http://msdn2.microsoft.com/en-us/library/ms345182.aspx . I also used http://www.sqlstrings.com/ as a reference when creating the connection string.


Creating a Foreach Loop Container:

1. Opened foreach loop container 2.Set the Enumerator to 'Foreach File Enumerator" and configured the enumerator by setting the directory location and file base name to E:ClientsDep CommBEABEA_Test_Source and *PersonnelExpense*.xls respectively. 3. Clicked Variable Mapping; created two variables called, "ExcelFile", and "ExtProperties" and closed out of the foreach loop container.

I. Created Excel Connection:

Created excel connection called, €œDynamic Excel Connection Manager,€? that initially pointed to one of the excel workbooks.
Went to the connection properties by right clicking the connection manager.
Expanded Expressions and clicked the ellipsis button to bring up property expressions
Chose Connection String in the Property.
Clicked the Expression Ellipsis button.
Put the following inside the Expression multi line text box:
A. "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @[User::ExcelFile] + ";Extended Properties="" + @[User::ExtProperties] + """

Clicked the Evaluate Expression button to get the following:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=;Extended Properties=""
Clicked Ok button
Inserted a Data flow task inside the foreach loop container.

II. Configured Tasks that is associated with Dynamic Excel Connection Manager or Package:

Set the Foreach loop container Delay Validation to true.
Set the Data Flow Task Container Delay Validation to true.
Set the Dynamic Excel Connection Manager Delay Validation to true.
Set the SQL Server Connection Manager Delay Validation to true.
Set the Package Delay Validation to true.
Package Locale ID set to English


Ran the package after connecting the excel source data flow to the OLEDB destination and have inserted part of the error in this post. Please see below.

Error: 0xC0202009 at Package, Connection manager "Dynamic Excel Connection Manager": An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Could not find installable ISAM.".

I modified the connection string after receiving the error by removing the extended properties. The following is the modified connection string: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @[User::ExcelFile]

I repeated step I.6 above and received the following expression: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=

I ran the package and received the following error in part: OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Unrecognized database format 'E:ClientsDep CommBEABEA_Test_SourcePersonnelExpense_OCCs_051007.xls'."


I did not find anything helpful when I searched for the above errors and would very much appreciate anyone€™s assistance on this issue as this issue needs to be taken care of ASAP.

Does anyone have any ideas as to why I received this error and what can I do to resolve this issue?

Your assistance in this matter is truly appreicated!
Thanks!!
Lee

View 7 Replies View Related

Unable To Retrieve Column Information In Flatfile Connection Within Foreach Loop Container

Jan 11, 2007

Hello, I am getting very frustrated! I have got a Foreach loop container which I am processing files within a folder. I have a flatfile connection manager which I have set up using a test file and have updated the expressions attribute to be the package variable I set up in the collection for the loop container however everytime I run it I get the error: 0xC0202094 cannot retrieve the column information from the flatfile connection manager. I can only guess that it is either the variable being passed to the connection manager or the way I set up the connection manager. When I msgbox the variable in a script component before the dataflow step, the variable for the file seems fine. Any suggestions are REALLY appreciated.

Yours

Jayne

View 2 Replies View Related

Getting Access Denied To FileName Error When Using The Execute Sql Task (With File Connection) Into A Foreach Loop Container.

Jan 18, 2007

Hi ALL,

Getting Access Denied To FileName Error When Using the Execute Sql Task (With File Connection) into a Foreach Loop Container.

Please Note :

I have a folder containing .sql files. I have to dynamically loop through the files and send them as a File connection Folder to the Execute Sql Task.

When I run this Package I am getting the follwoing error :

[Execute SQL Task] Error: An error occurred with the following error message: "Access to the path 'C:ProjectsFuzzy Lookup DataFlow ExampleScripts' is denied.".

Also I have logged in to the machine as Administrator and to Sql Server with sa.

Please help.



Thanks.

Regards,

Salil

View 1 Replies View Related

Checking Number Of CPU's On A Server

Feb 20, 2007

Hi

Will seem to be a basic question.

How can I check the number of CPU's used by a SQL Server.

Thanks

View 1 Replies View Related

Copy Data To SQL Server By Checking (available)

Oct 1, 2001

Hello,

I connect from SQL Server on Windows 2000 to Progress
Database on UNIX.
The database name of SQL Server is cstarsql and the
name is cstarint on UNIX.

I would like to schedule to copy data from
cstarint(Progress) to cstarsql(SQLServer). I did for
one time, but I want to control if the data has
already copied or not. If not, it will copy.

In DTS Query Builder to copy from Progress to SQL
Server,
SELECT * from calls WHERE call_date = TODAY
The name of table of calls is the same for both
database.The above calls is cstarint(Progress
Database)
This command is enough for one time. But I need to
control if the record has already copied.


In SQL Server, I control if the record is available or
not with @@FETCH_STATUS .
Now I would like to mix two queries, but I couldn't.
Can anybody do this?

DECLARE calls_cursor SCROLL CURSOR
FOR SELECT * FROM calls
WHERE call_date = TODAY

OPEN calls_cursor

-- Perform the first fetch.
FETCH NEXT FROM calls_cursor

-- Check @@FETCH_STATUS to see if there are any more
rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN
-- This is executed as long as the previous fetch
succeeds.
FETCH NEXT FROM calls_cursor
END

CLOSE calls_cursor
DEALLOCATE calls_cursor

Alice

View 1 Replies View Related

Checking NT Logs From SQL Server Client

May 1, 2001

Dear All,
We have recently moved our NT boxes with SQL Server to
a new computer room 10 minutes walk away.
Is it possible to examine the NT error logs from a SQL
Server client using perhaps an xp command?

Many Thanks in Advance,
Andrew

View 1 Replies View Related

Checking The User's Server Role

Jul 23, 2005

I would like to determine if a particular user has sysadmin serverrole. Is there a way to do this via the connection string? Currentlyour code checks if a login is valid using SQLDriverConnect, however weneed to be certain that the user can login and modify the schema.Is it possible to fetch a user's server role to determine if it has asysadmin server role?

View 2 Replies View Related

Checking The Existance Of A File On An FTP Server

Oct 29, 2007

Hello guys,

Using SSIS, I want to check if a specific file exists on an FTP server or not. If yes, then i'll go with a flow, and if not, i'll go with another flow. Any help with that?

Thanks in advance

SHIKO

View 1 Replies View Related

Checking Linked Server Status

Oct 26, 2007

Is there a quick way to determine linked server availability. I've got some select statements wrapped up in TRY/Catch blocks which will re-direct any failures to retreive data from a linked server to the catch block and I can get my data from elsewhere, but I have to wait for the statement to fail before I can jump into the catch block. I hoped to speed the process up by using an if exists check on the status of the linked server . Is there such a thing as a quick check on whether or not a linked server is online?

THX

View 1 Replies View Related

Checking Server Availability When Using Dynamic Server/DB Names

Apr 15, 2008



I am building an SSIS package that is hitting about 50 remote servers. I have a for each loop container that i am using to build the list of servers to run.

The problem is...sometimes networks go down, sometimes connections time out and this causes my entire package to fail. I inserted a task that will run select @@ServerName on the remote server inside the loop. My thought was, if this returns an error I could ignore it and move on to the next server in the list and log somewhere that server x threw an error. Logging is easy, the problem is, how do I then tell it to move on to the next server in the loop?

If anyone has any suggestions on how better to do this, I am open for alternatives...

View 4 Replies View Related

Best Method Of Checking For Duplicate Entries In SQL Server

Aug 22, 2007

Here is my situation.  I have a table in my application that pairs users with cars they like.  We'll call this table Favorites.  A user can browse the site and they can designate as many cars they want as favorites.  For example, a user can go to the Honda Accord page and add that as a favorite car and then go to the Toyota Camry page and add that as a favorite car.  However, if he/she goes to that Honda Accord page and tries to click the "Add to Favorites" button again, at the present state of my application, it will just add another entry into the Favorites table with a duplicate pairing.  So, if I were to datalist the table to generate a listing of all favorites belonging to a certain user, he/she may potentially be returned with superfluous duplicate entries.  Not to mention, taking up valuable database space and not looking very professional.
In my Favorites table, the 3 fields are.....favoriteId (set as primary key)userIdcarId
I've been thinking about this for awhile and I've come up with 2 solutions.  I'm a newbie to ASP.NET/programming so I don't have enough insight to make a decision or to even think up of other alternatives.
1) Check proactively by doing a.....SELECT favoriteID FROM Favorites WHERE userId = x and carId = y  (where x and y are variables)If I get a null return, it means I can go ahead and let the user add the car as a favorite in the database.  If I get a valid value, then it means there already exists the same pairing, so I exit out without updating the table.
2) Check reactively by forcing an exception whenever a user tries to enter a duplicate pairing.  I'm not sure how to do this, but perhaps, instead of making "favoriteId" a primary key, perhaps, I can make a primary key pairing of "userId" and "carId".  And by trying to do an insert with a primary key that already exists, we know it won't work since primary keys by definition are unique.
Now, I expect some concurrent users on my site, so I must take into consideration pros and cons of each and determine which is more efficient.  Checking proactively will force a check even if the table does not contain a duplicate pairing of user and car.  However, having a duplicate primary key may be more expensive from a database point of view and may slow down lookups, etc.  Or maybe neither has significant benefits, in which case, I rather go with proactive, since I've already coded it and it works fine.  Or maybe there is a third alternative, which I did not think.  Which method do programmers usually take and which is a better practice?
TIA for your help.

View 5 Replies View Related

Checking Last User Identity On Remote Server

Oct 12, 2006

Is it possible to get the latest inserted Identity value on a remote server?

(The following gives a NULL result:

select ident_current('[my_linked_server].thedatabase.dbo.thetable')

)

View 4 Replies View Related

SQL Server - Checking Inserts / Updates After DTS Package

Oct 30, 2007

Hi All,

I'm a relative novice on SQL Server and am a complete beginner at SQL, so am looking for a little help.

I currently use a DTS package to perform inserts / updates to a "production" table.

The DTS package transforms a comma separated file into a "temporary" table that is truncated / cleared before the load starts.

The temporary table has a column denoting Insert or Update. The production table is almost identical, however, doesn't contain the Insert / Update column. The DTS package then, depending upon the Insert / Update flag, either inserts data into the production table or updates data in the production table.

When the DTS package has completed, I'd like to be able to run an SQL Query that validates everything in the "temporary" table is identical to that in the "production" table, which it should be.

I have managed to do some queries to verify that everything has loaded / updated i.e. select primary_key from temporary table where primary_key not in (select * from production table), however, what I haven't been able to do is verify that all the columns on the temporary table match the values in the production table (excluding the Insert / Update flag).

I tried concatenating the columns in each table and comparing the concatenated values, however, this failed due to the different data-types, i.e. decimal, text etc.

Any help will be greatly appreciated.

Many thanks.

Cheers,

David

View 8 Replies View Related

Checking User Priviledges Om SQL Server 2000

Oct 30, 2007

Short of doing an INSERT and subsequent DELETE on a table, how do I figure out if a user has INSERT/UPDATE/DELETE access to a particular table?

View 11 Replies View Related

What's The Best Approach To Time-based Checking From App. To SQL Server?

Jan 14, 2007

Hi

I have an VB.NET application connected to a SQL Server Express. I want to let the application to run in either "Normal mode" or "Holiday mode" according to current weekday is normal day or state public holiday.

My approach is to find out all the public holidays in a year and enter them into a Holiday Table. Then some code in my application constantly check the current weekday against the one in the holiday table, if matches, the application goes into holiday mode.

This approach is not perfect as "State public holidays" are confirmed by the state government in the current year and the coming year. So state public holidays are unconfirmed for the third year afterward. The system is required by client to support public holiday in the next 10 years.

I wonder what is the best approach to this problem?

Thanks

View 5 Replies View Related

SQL Server 2012 :: Updating Table2 By Checking Table1

Apr 23, 2014

I want to update table2 by checking table1.

if trauma has atleast 1 then clm2 in table2 would be 1
if infec has atleast 1 then clm2 in table2 would be 2

table1

Clm1 Clm2
Trauma 1
Trauma 1
Trauma 1
Infec 2
Infec 2
Trauma Null

table2

clm1 clm2
Trauma 1
infec 2

I have to update table2 based on table one ny checking multiple columns.

View 2 Replies View Related

SQL Server 2012 :: Date Range Checking In Table

Mar 16, 2015

I have a table with EmployeeID, StartDate, and EndDate with a PK of EmployeeID, StartDate. How can I check to see that there's no overlap for StartDate and EndDate for a given employee? That is, on any given day there must only be 1 row for an employee where Getdate() is Between StartDate and EndDate. For an active employee their EndDate is set to 06/06/2079.

I've tried it using Row_Number() with Over() but am returning too many rows indicating overlap when none exists.

View 7 Replies View Related

Loop Though Table Using RowID, Not Cursor (was Loop)

Feb 22, 2006

I have a table with RowID(identity). I need to loop though the table using RowID(not using a cursor). Please help me.
Thanks

View 6 Replies View Related

SQL Server 2014 :: Best Design For Multiple Validation Checking Of Data

Sep 17, 2015

I want to do something with error checking in my company. For this we have a selection of different tables and the data needs to meet various validation rules else it is classed as an error.

To deal with this I'm currently thinking of this approach:

1. Create a view pulling all of the various data together from the multiple tables.
2. Create an empty 'errors' data table.
3. Create an Excel file with a button to call a Check for Errors Script

Then in the the script:

1. Clear the 'errors' data table
2. Call multiple scripts, each of which uses the new view, applies the checks for that specific error and writes any erroring data into the 'errors' data table (along with a text string with the unique error code for filtering / sorting purposes).
3. After calling all the scripts, the table can be refreshed in excel when when used with a pivot table can show the various errors, and let us drill down into all the data so we can fix them.

Also.. Ideally, I'd like some way to write comments in an excel column for each entry and error code and be able to write that back into a comment table.

View 5 Replies View Related

Detect That SQL Server 2005 Is Checking A Specific Database On Its Startup

Oct 3, 2007

Hello,

is there a way to find out that SQL Server 2005 (Express) engine is performing startup checked of a selected database?

The problem we are faced to is that our users shutdown brutally their laptops running their database. When they start laptops again, they impatiently start the application that tries to connect to the database. However, they get an error message:

Cannot open database XXXXX requested by the login. The login failed.

When they try after a minute or two, it works.

What we would like to do is provide an information message that the SQL server is checking the database and that they must wait for a while. Is there is a specific error code for this, can anyone help? We are using .NET 2.0.

Thank you,
Jan

View 5 Replies View Related

SQL Server 2008 :: Checking Files In A Shared Path If Folder Or File?

Jun 3, 2015

I wrote the below script to print all folders and files located in the share path. How to extend my script to mention by adding another column whether the file is a folder/file , sort of 0 or 1.

declare @chkdirectory1 varchar(4000) = 'shared_pathfolder';
declare @finalserver3 varchar(4000);
create table #tmp (directory_name varchar(4000))
SET @finalserver3 = '''"DIR ' + @chkdirectory1 + ' /B"''';
--select @finalserver3
--SELECT @finalServer
DECLARE @ExecCmd varchar(100)
--SELECT @ExecCmd = 'EXEC master.dbo.xp_cmdshell ' + char(50) + 'mkdir D:'+ CONVERT(varchar(8), getdate(), 112) + '' + char(50)
SET @ExecCmd = 'EXEC master.dbo.xp_cmdshell ' + @finalserver3
--SELECT @ExecCmd
exec(@ExecCmd)
drop table #tmp

View 0 Replies View Related

Foreach Loop Doesn't Loop

Mar 3, 2006

I have a foreach loop that is supposed to loop through a recordset, however it doesn't loop. It just repeats the same row, row after row.

I would like to look into the recordset variable but I can't because it is a COM object and the ADODB namespace is not available in the script task.

Any solution to this? anyone experienced anything similar

View 1 Replies View Related

Fishing For A Clue. To Loop Or Not To Loop

Jul 8, 2006

I have a table called Tbltimes in an access database that consists of the following fields:

empnum, empname, Tin, Tout, Thrs

what I would like to do is populate a grid view the a select statement that does the following.

display each empname and empnum in a gridview returning only unique values. this part is easy enough. in addition to these values i would also like to count up all the Thrs for each empname and display that sum in the gridview as well. Below is a little better picture of what I€™m trying to accomplish.

Tbltimes

|empnum | empname | Tin | Tout | Thrs |

| 1 | john | 2:00PM | 3:00PM |1hr |

| 1 | john | 2:00PM | 3:00PM | 1hr |

| 2 | joe | 1:00PM | 6:00PM | 5hr |

GridView1

| 1 | John | 2hrs |

| 2 | Joe | 5hrs |

im using VWD 2005 for this project and im at a loss as to how to accomplish these results. if someone could just point me in the right direction i could find some material and do the reading.

View 18 Replies View Related







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