Script Task - Am I Leaving Any Resources Open?
May 31, 2007
I've got a service that waits for a file to drop and then calls a ssis package that then gets a date from the first line of the file, sets it to a variable, then imports the rest of the file using the flat file import through a data flow task.
Occasionally the script task fails with this error message:
The script threw an exception: Access to the path 'C:pathflatfile.txt' is denied.
Here is the code of my script:
Public Sub Main() ' ' Add your code here ' Dim vars As Variables Dts.VariableDispenser.LockOneForRead("User::FullFilePath", vars) Dim filepath As String = vars("FullFilePath").Value.ToString() vars.Unlock() Dim file As File Dim reader As StreamReader reader = file.OpenText(filepath) Dim line As String line = reader.ReadLine() reader.Close() 'MsgBox(line.Substring(29)) Dim asofdate As String asofdate = line.Substring(29, 5) asofdate = asofdate + "20" + line.Substring(34) 'MsgBox(asofdate) Dim writeVars As Variables Dts.VariableDispenser.LockOneForWrite("User::AsOfDate", writeVars) writeVars(0).Value = asofdate 'MsgBox("done") writeVars.Unlock() Dts.TaskResult = Dts.Results.Success End Sub
Does anyone see anything that I'm not. I believe i'm closing all necessary resources and streams. Does anyone have suggestions.
Thank you very much in advance.
View 3 Replies
ADVERTISEMENT
Nov 8, 2000
I upgraded from SQL 6.5 to 7.0. Because I got a number of errors I went back
to 6.5. Now I want to try again to upgrade to 7.0. How can I do that?
Do I have to uninstall 7.0 and reinstall?
If I uninstall 7.0 will that blow away 6.5?
Thanks
JJ
View 1 Replies
View Related
Feb 20, 2008
Hi,
I have a database which has two db_owner (dbo and a user).
The user has left the organization a while ago.
Can I remove him or do I need to replace him?
What will happen if I remove him?
Do I need to keep dbo there also?
View 8 Replies
View Related
Nov 14, 2000
I would like to dynamically copy a table in Transact SQL, like this:
SELECT * into NEW_TABLE from MY_TABLE where 1 = 2
This creates an empty NEW_TABLE as desired. However, NEW_TABLE retains the column nullability of MY_TABLE; I would like NEW_TABLE to have all its columns nullable.
I tried to write Transact SQL logic to update the isnullable column in syscolumns for NEW_TABLE, but was told that the entire SQL Server would have to be reconfigured to allow this.
Does anyone know of another way to do this?
View 1 Replies
View Related
Oct 4, 2007
Hi folks. Thanks for the opportunity to get a bit of help here.
I've got two tables. Say, table "foo" and table "bar".
I LEFT JOIN them on a key, say, foo.id and bar.fooid.
For some reason, when I do this join, I get only records from "foo" which have a mate in "bar".
What I really need is all records from "foo", but the columns from bar when there is a match. I don't want to exclude records from "foo" just because they don't have a match from "bar".
Am I just misusing LEFT JOIN?
Any guidance would be greatly appreciated.
View 5 Replies
View Related
Apr 25, 2006
I Can't reproduce the error if I run the package stand-alone.
I'm using the same lookup call (same table, etc.) in 2 packages that are running in parallel (called by a parent package).
[LKP_UnderwriterId [72283]] Error: An OLE DB error has occurred. Error code: 0x80040E05. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80040E05 Description: "Object was open.".
Anyone seen this one?
View 3 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
Feb 13, 2007
Hi, everyone!
I have this strange problem... After every time my application leaves sql-server idle (doesn't send anything, doesn't retrieve anything) next command to sql-server processes really long.
I've also noticed this bug/feature/misconfiguration even if I open a DB in Management Studio...
Please, could someone tell me, is there any timer that "puts a DB to sleep" if no one is using it for some time? Can I change the way server behaves in this situation?
View 4 Replies
View Related
Oct 23, 2006
Hi
I couldn't find an 'SQL Server Agent' Forum , so I'm posting this here...sorry.
I'm using a job to run a batch file with several robocopy commands in it.
The step in the scheduled job runs a SSIS package saved in the Server Package Store.
The SSIS package uses an 'Execute Process Task' control flow item.
The 'Execute Process task' simply calls and execute the batch file. (WindowStyle property = Maximized)
The package/job runs fine in both Visual Studio and in Management Studio. However when run from the latter (SQL Management Studio Job) the command prompt window (dos screen) doesn't open so I can't tell at what stage the batch file is in at any given time.
How can I get the window to open? By the way the window does open if I run the SSIS from Visual Studio.
Thank you
View 1 Replies
View Related
Jun 12, 2015
I am using SSIS 2008 tool for developing ETL package. I get below error whenever I click on script task editor.Cannot show Visual Studio 2008 Tools for Applications editor. (Microsoft Visual Studio).
View 2 Replies
View Related
Oct 7, 2012
I want to open a excel file in script task and assigned the wraptext to one of the column. In the below code the final variable gives the path of the excel file. But i got the error at excel.workbook.open.
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC
at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local,
[Code]....
View 4 Replies
View Related
Sep 7, 2007
I get the below error only when my IDE open. It connects well when it is found closed.
[SqlException (0x80131904): Cannot open user default database. Login failed.Login failed for user 'JPASPNET'.]
I could solve this by giving the logged in windows user to impersonate under IIS window > WEBSITE > ASP.NET tab > EDIT CONFIG > APPLICATION tab
But I wish someone could give me the proper solution.
I almost tried all from giving ASPNET user as a administrator to configuring the same in Express management tool.
Environment: XP pro, VWD and SQL Express
View 3 Replies
View Related
Jun 7, 2006
Hi there,
I got an approach like that:
1) Read something from DB - check the value, if true stop if false go on2) Read the second Value (another SQL Statement) - check the value etc.
Now I could open the connection at 1) and if I have to go to 2) I leave the connection open and use the same connection at 2). Is it ok to do that?
The other scenario would be opening a connection at 1), immediately close it after I read the value and open a new connection at 2).
Thanks for the input!
View 4 Replies
View Related
Nov 3, 2014
Post installation of SQL Server 2014 Express edition, I am able to connect to the Database Instance.
But while opening a new query window in SSMS or opening a table getting the error:
Package 'RadLangSvc.Package, RadLangSvc, Version 12.0.0.0, Culture=Neutral, Public Token=89845dcd8080cc91' failed to load
Object reference not set to an instance of an object. (mscorlib)..Have already tried installing the componentsDACProjectSystemSetup_enu.msi, TSql LanguageService_enu.msi, DACFramework_enu.msi from path VS 2010 WCU DAC.
View 5 Replies
View Related
Nov 10, 2003
I used SqlConnection/SqlDataReader to read data from SQL Server 2000 in my ASP.NET project, but I found that the CPU usage is too high, and I used SQL Query Analyzer to run the same SQL statement, The CPU usage is the half of the previous, is there anyone can tell me why? Thank you!
View 1 Replies
View Related
May 8, 2006
Hi everyone!Being new the SQL, I wanted to ask everyone if there are good resources out there that they use? I could use all the help I can get! Books, links, websites, etc.Recently my friend sent me this, I found it informative and best of all, free! https://store.pentontech.com/index.cfm?s=9&promocode=qe2165f7
Thanks in advance for your help!- Lizzy
View 2 Replies
View Related
Jul 5, 2001
Sometimes logging in to SQL 7 I get 'Memory resources not available...' and
log in process terminates. Do I need to up number of locks !
If so, how ! Pls. suggest any other ideas !
I have 2g ram, 4 CPUs NT 4 SP5
Thanks,
Rick
View 2 Replies
View Related
May 5, 2006
This proc will show you what is using SQL system resources right now. If a process is not currently using any resources, it will not show up on the list. Also, a dump of the input buffer is printed so you can see just what is going on.
I use this code whenever somebody whines that "The server is slow!".
The magic is ::fn_get_sql which came with service pack 3 for sql 2000.
use master
IF (object_id('sp_Now')) is not null
BEGIN
PRINT 'Dropping: sp_Now'
DROP PROCEDURE sp_Now
END
PRINT 'Creating: sp_Now'
GO
CREATE PROCEDURE sp_Now
as
-- FULL DETAILS OF WHAT IS RUNNING
set nocount on
declare @handle binary(20),
@spid smallint,
@rowcnt smallint,
@output varchar(500)
DECLARE TEST CURSOR FOR
select sql_handle, spid
from sysprocesses
where sql_handle <> 0x0000000000000000000000000000000000000000
-- and spid <> @@SPID --> Uncomment to stop seeing your own process
order by cpu desc
OPEN TEST
FETCH NEXT FROM TEST
INTO @handle,
@spid
set @rowcnt = @@CURSOR_ROWS
print '===================='
print '= CURRENT ACTIVITY ='
print '===================='
print ' '
set @output = 'ACTIVE SPIDS: ' + convert(varchar(4),@rowcnt)
print @output
WHILE @@FETCH_STATUS = 0
BEGIN
print ' '
print ' '
print 'O' + replicate('x',120) + 'O'
print 'O' + replicate('x',120) + 'O'
print ' '
print ' '
print ' '
select convert(char(15), loginame) as 'loginame',
convert(char(10),hostname) as 'hostname',
convert(char(20),db_name(dbid)) 'database',
str(spid,4,0) 'spid',
str(blocked,5,0) 'block',
-- str(waittime,9,0) 'wait_time',
str(physical_io,8,0) 'phys_io',
-- str((cpu),10,0) 'cpu(ms)',
-- str((cpu/60000.0),9,3) 'cpu(mins)',
str((cpu/1000/60),6) + ':' + case when left((str(((cpu/1000) % 60),2)),1) = ' ' then stuff(str(((cpu/1000) % 60),2),1,1,'0') else str(((cpu/1000) % 60),2) END as 'cpu(mm:ss)',
str((convert(float,memusage) * 8192.0 / 1024.0 / 1024.0),8,2) 'mem(MB)',
convert(char(30),program_name) as 'program_name',
cmd,
convert(char(15),lastwaittype) 'lastwaittype',
convert(char(20),login_time,120) 'login_time',
convert(char(19),last_batch,120) 'last_batch',
convert(char(10),status) as 'status',
convert(char(15),nt_username) as 'nt_username'
from master..sysprocesses
where spid = @spid
print ' '
print ' '
dbcc inputbuffer(@spid)
print ' '
print ' '
select * from ::fn_get_sql(@handle)
FETCH NEXT FROM TEST
INTO @handle,
@spid
END
close TEST
deallocate TEST
GO
IF (object_id('sp_Now')) is not null
PRINT 'Procedure created.'
ELSE
PRINT 'Procedure NOT created.'
GO
View 2 Replies
View Related
Jul 31, 2006
Hi,
Im just looking for someone that has a demonstration Visual Basic database script.
Something that makes a database, ad / removes rows and information, does all basic database stuff, just as an example of how a SQL database is supposed to be handled.
Anyone have any links?
View 4 Replies
View Related
Jul 23, 2005
I know that a query inside a called UDF does not show up when displaying theestimated query plan, but are the resources (CPU, DiskIO) used by a UDF thatis call from within an SProc or embedded in a SQL statement included insp_who2 and Profiler BatchCompleted?Also how performance draining is it to do something like the following. Iassume for every row returned the udf will be called causing 8000 tablescans on DateTable?Create Functionu udf_GetCountDates (@StartDate datetime, @EndDate datetime)Returns IntbeginReturn(select count(*) from DateTablewhere ColDate > @TestDate and Col1Date <)end--DateTable has 5,000 rowsCreate proc Test@TestDate datetimeAsselect Col1, Col2, udf_GetCountDates(@TestDate, Col2)From OTable--OTable has 8,000 rowsGoThanks,Ray
View 1 Replies
View Related
Jul 20, 2005
I have a question...say I have an asp app that works as a front end toan sql server 2000 database. Would it be better, performance wise, toseperate the webserver from the sqlserver or to have them on the samemachine?-Jim
View 2 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
May 13, 2004
I have a sql job(that runs several stored procs) that is run to fix a problem, it is set to run every few minutes (no, this is not my idea). What would be the best way to identify how much this specific job/and it's sp's are using in resources, such as cpu and memory?
View 1 Replies
View Related
Jun 19, 2002
I was thinking of doing certification from Microsoft. I was first intending to write exam 70-229 which is :
Designing and Implementing Databases with Microsoft SQL Server 2000 Enterprise Edition.
The Microsoft site http://www.microsoft.com/traincert/exams/70-229.asp#TOOLS has a list of topics that I need to be familiar with in order to pass the exam, but it does not have the detailed information.
Can someone guide me to a place where I can go to get the detailed information about these topics so that I can prepare better for the certification exam?
thanks
Aslam
View 1 Replies
View Related
Mar 9, 2006
Hi folks, thought I'd wade into the mssql waters, I've used mysql for some time, thought I'd familiarize myself with the other.
I downloaded mssql server 2005 express edition. Don't know if I missed anything on the site, maybe I did. I've got it running from the command line.
Are there any GUIs out there that are decent to use? Where can I download it?
Is there a specific manual available like mysql has? I think I stumbled across something but wasn't sure it was searchable, sorry the link is on my other 'puter at the moment so I can't see what I was looking at.
perhaps a sticky in this forum with good resources would be helpful to all.
Thanks,
Dave
View 1 Replies
View Related
May 21, 2008
I normally develop for MySQL and PHP, but we have a new application that runs on MS SQL and I'm having difficulty using the same structure as MySQL to run queries. Can someone here point me to a good resource to learn the basics?
Thanks!
View 1 Replies
View Related
Oct 20, 2005
Hello, I need to know how to see the cpu and memory usage per session, and the cause (What query is causing It)
View 2 Replies
View Related
Jun 13, 2007
Hi
I have a problem on microsoft sql server 2000.
I need to limit the amount of resources(eg cpu, mem..) a query uses
Is there a way to do this in SQL server 2000
Thks in advance
:eek:
View 1 Replies
View Related
Mar 31, 2008
What will happen if I'm running a query with the NOLOCK hint but the SQL Server has run out of resources?
Thanks!
View 2 Replies
View Related
Apr 2, 2008
Hello,
There are many Errorcodes which SSIS uses to represent errors, warnings etc.
List of errorcodes are at: http://msdn2.microsoft.com/en-us/library/ms345164.aspx
Now, in my SSIS package, I have defined error handler(OnError) and warning handler(OnWarning) to handle the events. Which logges them to a flat file with some formatting and condition checks including addional information about faulty row.
I dont want to log the exact error messages sent by SSIS as they are too much technical and not understanadble by normal user. I want them to be replaced with some custom message which I 'l pick from some resource file by matching the ErrorCode. One can consider this resource file as collection of key(ErrorCode), value(Custom Error Message) pairs.
In .NET we normally use resource files(.resx) to achive the same task. I found no way to use such resource files in SSIS.
Is there any way by which I can implement this functionality?
I dont want to implement custom logging mechanism as it does not fit into my application needs.
Please guide.
View 2 Replies
View Related
May 8, 2007
Hi
SQL Server is using up all of my system resources and i can't find where the problem is, i have used
exec sp_who
exec sp_who2
but i don't know what to look for, i'v even checked the memory comparison according to SQLSkills but that is all fine, the server is extremely slow all the time. I battle to open Query analyser or even just to connect to it takes forever, any advice would be greatly appreciated.
Kind Regards
Carel Greaves
View 7 Replies
View Related
May 8, 2006
could we download the videos of SQL Express learning resources as we can do it with the VWD, VB, C#????
there is another link to do it???
will they be available in a short future?
View 1 Replies
View Related
Apr 10, 2000
The errormessage after a deadlock gives very little information: "Your transaction (process ID #12) was deadlocked with another process and has been chosen as the deadlock victim. Rerun your transaction."
But what resources, ie tables, indexes etc, are really deadlocked?
Is it possible to set a switch or something to log all relevant information about a deadlock for later investigation?
View 2 Replies
View Related