Can Any One Write A Small Script Component???
Apr 18, 2008
I have to write a script compnent.
I have a column ID that has to incremented for each row.
I have to write something like. Incrementing Variable = Max( ID) + incrementing variable
Please let me know.. I am told that there are two statements involved in this operation.
Thanks
View 3 Replies
ADVERTISEMENT
Apr 24, 2008
I have an SSIS package that produces an Excel output file say File1
The Excel output file is created from a previous script task by copying a standard excel template to File1
after the copy, File1 has the disclaimer, legend etc... and a header row at row 10.
So data rows should only start at row 11.
I was googling and found that people who read Excel file using an Excel source component have been successful reading
from a range by the use of the OPENROWSET property. It is said to set this property to Sheet1$A5-B999
to start reading from row 5.
I tried to set the OPENROWSET property to be Sheet1$A11-B999 but am getting an error "Check that object exists"
(Sheet1 does exist) So I guess it is the range that has an improper syntax or something else is wrong.
Please advise. Thanks
View 1 Replies
View Related
May 8, 2008
Hi,
I have a script component that contains a script similar to that shown below;
Public Sub Main()
Dim sqlConn As New SqlConnection("Server=myserver;Database=mydb;Trusted_Connection=True;")
Dim SQLStmt As String
SQLStmt = "select top 10 CountID from mytable"
Dim sqlComm As New SqlCommand(SQLStmt, sqlConn)
sqlConn.Open()
Dim r As SqlDataReader = sqlComm.ExecuteReader()
While r.Read()
Dim MyValue As Integer
If r("CountID") IsNot DBNull.Value Then
MyValue = CInt(r("CountID "))
' HERE I WANT TO WRITE MyValue TO A PACKAGE VARIABLE AS A ROW
End If
End While
r.Close()
sqlConn.Close()
Dts.TaskResult = Dts.Results.Success
End Sub
Once i have a value assigned to MyValue, I want to write this as a row to a variable (DATATYPE Object Value VALUE System.Object) in the package which will be an ADO Recordset Destination that i can then loop through later.
Many thanks for any help
Phil Harbour
View 1 Replies
View Related
Dec 25, 2006
I want to store a small cirle in a text field. Can anyone tell me how I can enter it in ascii code.
Thanks
View 4 Replies
View Related
Sep 26, 2006
Hi,
I am trying to develop a SSIS package which will read the records from the flat file and insert them into a destination table. I have some validations written in script component. I have declared two Read Write variables with package level scope. when i try to assign a value to the variable in the script component and run the package, the package throws me an error "The collection of variables locked for read and write access is not available outside of PostExecute".
What should be done to over come the problem please help me on this regard
Thanks
Madhavan.M
View 15 Replies
View Related
Oct 26, 2007
Hello,
I have a package that has a data lfow task. this task imports data from a db2 database (using the IBM Ole DB provider fro db2) and adds it to sql server database table. This package was created on the server. then though version control (using TFS source control) I check out the package on my local machine. and when I open the package I get the foll 3 errors.
Error 1 Validation error. Import Account Num from BMGP_BDR: DTS.Pipeline: The component metadata for "component "DataReader Source" (1113)" could not be upgraded to the newer version of the component. The PerformUpgrade method failed.
Error 2 Error loading BMAG Download Xref Tables - bmag.dtsx: Microsoft.SqlServer.Dts.Pipeline.ComponentVersionMismatchException: The version of component "DataReader Source" (1113) is not compatible with this version of the DataFlow. [[The version or pipeline version or both for the specified component is higher than the current version. This package was probably created on a new version of DTS or the component than is installed on the current PC.]] at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostCheckAndPerformUpgrade(IDTSManagedComponentWrapper90 wrapper, Int32 lPipelineVersion)
Error 3 Error loading BMAG Download Xref Tables - bmag.dtsx: The component metadata for "component "DataReader Source" (1113)" could not be upgraded to the newer version of the component. The PerformUpgrade method failed.
Please advice.
Thank you.
View 7 Replies
View Related
Jan 23, 2007
Hi,
I have a package which reads an Access file from a folder. My connection manager to this file is .NET providers for OledbMicrosoft Jet 4.0 OLE DB Provider.
Package works from my computer. But when I execute it on the server as a SQL Agent job, I get
The component metadata for "component "DataReader Source" (1) could not be upgraded to the newer version of the component. The PerformUpgrade method failed.
I copied the mdb file to a folder on the server which my packages have no problem reading data from.
My packages run under the same domain account as defined in proxies.
Appreciate a help.
Gulden
View 4 Replies
View Related
Mar 16, 2007
In a Data Flow, I have the necessity to use a SSIS variable of type €œObject€? inside Script Component and assign to it the content of 'n' variables of string type.
On exiting from the script the variable of type object should contain something like in the following lines:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDDDDDDDD
€¦€¦€¦€¦€¦€¦€¦.
€¦€¦€¦€¦€¦€¦€¦.
On exiting from the data flow I will use the variable of type Object in a Script Task, by reading each element in a cyclic fashion.
Is there anyone who have experienced something like this? Could anyone provide any example of that?
Thanks in advance!
View 3 Replies
View Related
Aug 13, 2007
Hi all
I'm into a project which uses a lot of views for joining 2 or more tables. Using the MERGE component in SSIS will be a huge effort coz it only has 2 inputs and I gotta SORT the input too.
Isnt it possible to have a VIEW like component that joins more than 2 tables and DOESNT need sorting??
(I've thought about creating views in database engine but it breaks my data floe in SSIS and is'nt a practical solution)
View 4 Replies
View Related
Mar 30, 2006
I am writing a custom dataflow transformation component and I need to get the name of the preceeding component.
I have been trying to find a way to get a reference to the Package object, MainPipe object or IDTSPath90 object (connecting to the IDTSInput90 of my component) from my component because I think from there I can get to the information I want.
Does anyone have any suggestions?
TIA . . . Ed
View 7 Replies
View Related
Nov 27, 2007
No idea where this bug crept in from. Have been using SSIS for 1.5 years now without hitting this problem.
I had a script component opening an XML document and parsing it using XPATH. I added some code that uses StreamReader / Streamwriter (closing one stream before starting the other). The code works without issue in my C# app.
And it ran without issue 2-3 times in SSIS. Then suddenly after running my package again, the script component says it completes successfully, yet nothing happens. I set a breakpoint on the first line of code - it never hits it. I add a msgbox as the first line of code - and it never displays.
I then close my package / exit out of ssis ... and then re-open it. When i open my script component, all of my code is GONE. All references that I added are gone.
I tried adding the streamreader/writer process to a dll I created from my c# app ... and added the DLL to the package -- same result.
I can reproduce this on 2 different computers.
Anyone experience this problem ? Any idea how to stop it ? Or debug it ?
Here is a slimmed down code sample of what causes the error :
Public Class ScriptMain
Public Sub Main()
Try
Dim xmlDoc As New XmlDocument
xmlDoc.Load("c:ulkasync_86281519_20070628045850225_4.xml")
MsgBox("xmlLoaded") --this doesn't display once the package starts "acting up"
Catch ex As Exception
MsgBox(ex.Message)
UpdateXML("c:ulkasync_86281519_20070628045850225_4.xml", ex.Message)
End Try
Dts.TaskResult = Dts.Results.Success
End Sub
Private Sub UpdateXML(ByVal fileName As String, ByVal message As String)
Try
Dim invalidChar As String = message.Trim().Substring(message.Trim().IndexOf("0x"), 4)
Dim rd As StreamReader = New StreamReader(fileName)
Dim xml As String = rd.ReadToEnd()
Xml = Xml.Replace(invalidChar, String.Empty)
xml = xml.Replace("", String.Empty)
xml = xml.Replace("<![CDATA[<![CDATA[", "<![CDATA[")
xml = xml.Replace("]]>]]>", "]]>")
MsgBox("replaced")
rd.Close()
Dim wr As StreamWriter = New StreamWriter(fileName)
wr.Write(xml)
wr.Close()
Dim xdoc As XmlDocument = New XmlDocument()
xdoc.Load(fileName)
Catch ex As Exception
UpdateXML(fileName, ex.Message)
End Try
End Sub
End Class
View 4 Replies
View Related
Jul 12, 2006
Hi,
I tried to backup the master key by the following syntax :
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'mypassword'
BACKUP MASTER KEY TO FILE = 'c: empmaster' ENCRYPTION BY PASSWORD = 'mypassword'
but it failed and i got the following message:
Cannot write into file 'c: empmaster'. Verify that you have write permissions, that the file path is valid, and that the file does not already exist.
NB: I am using the "sa" user to execute this command.
I know that we have a security permission issue , but where and how ?
Regards,
Tarek Ghazali
SQL Server MVP
View 12 Replies
View Related
Aug 6, 2005
How to retreive the value of last identity has been updated in a database (SQL Server)?
View 1 Replies
View Related
May 29, 2008
in command promt how to come out c drive to d drive
View 2 Replies
View Related
Mar 10, 2007
in my table have two column one post(varchar) and another one views(decimal).in table have no.of data's.......
sample data's
Ex i want this Result
post views post views
std 400 std 400
abc 100 abc 100
dbn 10 sdfe 75
sdfe 75 dbn 10
.... .....
..... ....
....
i need one query....... condition view best top 10 post based on views column
View 2 Replies
View Related
Sep 12, 2007
Hi,
I need to display only the char having start with 'ACCT -AMOUNT',Now problem is that some records having the lower case character like 'acct amount'.
But i want to display only the upper case char start with 'ACCT-AMOUNT'.
I have to used the 'like ' statement but it is showing all the row inculding the lower case also.
Please give me some clue reg. the issues.
Thanks,BPG
View 3 Replies
View Related
Sep 26, 2007
Hi,Probable there is a simple solution for this, hopefully someone candirect me in the right direction.I have a table with a persons firstname, lastname, birthdate andaddress. However, I want to select only one person per address, namelythe eldest of all persons living on the same address.Can anyone provide me a solution?Thanks in advance.Duncan
View 2 Replies
View Related
Jul 20, 2005
HelloI have a case where Partners are some kind of Super-Users and arestored in a SQL Server database. Best is IMO to put both in the sametable:table Customers:CustomerID[pr.key][blabla]PartnerIDBut of course I have to reference the partnerid from another table andI want SQL Server to maintain the integrity rules. I could splitCustomers en Partners into different tables, but that would not bewise i think.Or I could just reference the CustomerID from the other table and-know- that we are talking about a partner, but in that case it itpossible to reference a customer that is not a partner, and i want toavoid that.Any ideas?Freek Versteijn
View 4 Replies
View Related
Nov 27, 2007
Consider a recordset consisting of
Vendor, Invoice, InvAmt, Item,ItemAmt
1, 'A12345', 100.00,'Item1', 25.00
1, 'A12345', 100.00,'Item2', 50.00
1, 'Z22222', 200.00,'Item1',100.00
1, 'Z22222', 200.00,'Item3', 50.00
2, 'A12345', 300.00,'Item4,' 250.00
I have a report that groups by vendor and then by invoice within a vendor.
I want to create a report totals that contains
Number of vendors=2
Number of invoices=3
Total Inv Amounts=600.00
Total Item Amounts=475.00
How?
Number of vendors is =count(distinct vendors) ??
Cant do that for # Invoices because of possible duplicate invoices used by different vendors.
How do i get the total invamt? Each occurrence of the invamt fld is in a list2 as =first(invamt).
I really need the sum of each first(invamt).
Thanx Up Front.
Jerry C
View 9 Replies
View Related
Aug 17, 2007
i need to concatenate this two database fildes
PATNT_REFNO_NHS_IDENTIFIER defined as varchar
PATNT_REFNO defined as numeric
out put of these tewo colomns like
PATNT_REFNO_NHS_IDENTIFIER = NPA0123
PATNT_REFNO = 0125487
so i need to get a result like
NPA01230125487
any idea
regards
Niranga
View 1 Replies
View Related
Jun 18, 2007
I currently use JET 4.0 as my database in a small app I distribute. SQL Server Express is way way too big to distribute. I am looking to move to a better database.
Is there a version of SQL that gives simple database CRUD support, but is super small to distribute? I am also considering Firebird as it's a full database and only 3MB on the client as an embedded tool.
Ian
View 1 Replies
View Related
May 22, 2006
i have table cosists of 3 columns
i need to select multiple rows from the table
example : i need to select rows with id=(1,5,9,7,11,15,20,23,42,65) in one select statement
can any body answer me?
and i will give him a( )
View 3 Replies
View Related
Jan 18, 2004
Hi,
I'm just about to launch a forum, and right now its built in ASP classic with an Access db. I origianlly used Access because most hosts charge extra for MS-SQL server. Recently I switched to Jodohost who offers Access, MS-SQL and MySql for at no additional cost. So now that I have the option, I would like to pick the best solution before I launch.
* My questions are...
- What is the best db solution to go with for a currently small forum?
- How problematic do you think a data migration would be in the future if I stayed with Access for now and upgraded to MS-SQL with a full forum?
- Is it just smarter to go with MS-SQL now, with an empty forum, regardless of any preformance issues because potential migration problems are a greater risk?
- At what point does the speed of MS-SQL at high volumes over come the potential lags in accessing MS-SQL if it is hosted on a different machine from the one hosting the webpages?
* And please keep in mind...
- I have no db training. I can muddle through Access well enough, but administrating MS-SQL I think might be another story
- This fourm will start off very small, but could grow to be quite large
- I may not stay with jodohost, and would therefore likely have to pay more for MS-SQL (which I woudl rather not do)
View 1 Replies
View Related
Mar 10, 2004
Hello, could someone pls help me with this table design.
I have a project table and a code table. The code table has things like priorities (High, Medium, Low).
Now, I want all projects to be able to use these 'global' codes as well as define their own. So, they could define their own priority code 'Critical', that only their project can see.
Any help would be great.
View 1 Replies
View Related
Nov 17, 2005
I have listed a view below and a portion of the result set that is returned when I run the code in Query Analyzer. This is part of a timesheet application that logs hours per SCHLSTUID per SECTIONID per week. This returns the SCHLSTUID(user's ID), SECTIONID, Date that the week starts, the first date that time was logged. The user could be in several SECTIONID's for the same week. I need to modify this so that it returns the date that the first time was logged for any of the SECTIONID's per week. I know that this is probably something simple that I'm overlooking but I just can't get it to work correctly.Example: SCHLSTUID SECTIONID ATTSTARTDT FirstTimeEnteredDOn601868445 EN4AR001 2005-09-18 20:59:21.120 2005-09-19 20:59:21.120601868445 MAA1R001 2005-09-18 20:59:21.120 2005-09-18 20:59:21.120This would need to return 2005-09-18 20:59:21.120------------------------------------------------------------------------------------------------------601868445 EN4AR001 2005-10-02 20:59:37.427 2005-10-02 20:59:37.427601868445 MAA1R001 2005-10-02 20:59:37.427 2005-10-02 20:59:37.427This would need to return either 2005-10-02 20:59:37.427------------------------------------------------------------------------------------------------------601868445 EN4AR001 2005-10-09 20:59:37.823 2005-10-09 20:59:37.823601868445 MAA1R001 2005-10-09 20:59:37.823 2005-10-13 20:59:37.823This would need to return 2005-10-09 20:59:37.823----------------------------------------------------------------------------------------------------------------------------------------------------CREATE VIEW dbo.vExportStartWeekASSELECT TOP 100 PERCENT schlstuid, sectionid, ATTSTARTDT, MIN(TimesheetDate) AS FirstTimeEnteredOnFROM (SELECT schlstuid, sectionid, ATTSTARTDT, ATTSTARTDT AS TimesheetDate, sunmns AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, ATTSTARTDT AS TimesheetDate, sunhrs AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 1, ATTSTARTDT) AS TimesheetDate, monmns AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 1, ATTSTARTDT) AS TimesheetDate, monhrs AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 2, ATTSTARTDT) AS TimesheetDate, tuemns AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 2, ATTSTARTDT) AS TimesheetDate, tuehrs AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 3, ATTSTARTDT) AS TimesheetDate, wedmns AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 3, ATTSTARTDT) AS TimesheetDate, wedhrs AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 4, ATTSTARTDT) AS TimesheetDate, Thrmns AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 4, ATTSTARTDT) AS TimesheetDate, Thrhrs AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 5, ATTSTARTDT) AS TimesheetDate, Frimns AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 5, ATTSTARTDT) AS TimesheetDate, Frihrs AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 6, ATTSTARTDT) AS TimesheetDate, Satmns AS TimeEntered FROM TimeSheetDailyAttendance UNION ALL SELECT schlstuid, sectionid, ATTSTARTDT, DATEADD(d, 6, ATTSTARTDT) AS TimesheetDate, Sathrs AS TimeEntered FROM TimeSheetDailyAttendance) TimesheetDatesWHERE (TimeEntered <> 0)GROUP BY schlstuid, sectionid, ATTSTARTDTORDER BY schlstuid----------------------------------------------------------------------------------------------------------------------------------------------------This is a portion of what is returned:SCHLSTUID SECTIONID ATTSTARTDT FirstTimeEnteredDOn601868445 EN4AR001 2005-09-18 20:59:21.120 2005-09-19 20:59:21.120601868445 MAA1R001 2005-09-18 20:59:21.120 2005-09-18 20:59:21.120601868445 EN4AR001 2005-09-25 20:59:36.670 2005-09-25 20:59:36.670601868445 EN4AR001 2005-10-02 20:59:37.427 2005-10-02 20:59:37.427601868445 MAA1R001 2005-10-02 20:59:37.427 2005-10-02 20:59:37.427601868445 EN4AR001 2005-10-09 20:59:37.823 2005-10-09 20:59:37.823601868445 MAA1R001 2005-10-09 20:59:37.823 2005-10-13 20:59:37.823----------------------------------------------------------------------------------------------------------------------------------------------------Thank you for any help that you can give me.Scott
View 3 Replies
View Related
Dec 27, 2001
when i insert an empty date from an asp page, sql 7.0 generates a default value 1/1/1900. This is normal. However, I need to know how do I turn that feature off so I would not generate the default value.
Currently, my front in application uses asp--vb scripts. Please help.
I tried assigning a null value to my variant, but sql still generate that default date/time
View 1 Replies
View Related
Mar 12, 2001
Hello,
I'd like to confirm something regarding SQL Server account permissions. Is the NT domain admin also a member of the sysadmin role on the local server running SQL Server 7.0 on an NT 4.0 platform?
Thank you
View 2 Replies
View Related
Jan 24, 2001
I am trying to run a program that works on another site but with a copy of the database(SQL6.5) and the vb front end I keep getting a timeout error.
The vb bit is trying to run an update statement on a table with just over 2000 rows. I cannot amend the vb side because this is an .exe
Is there something I might not have done on the server that could be causing this not to work, i.e configuration issues, bigger logs
Please help!!
View 2 Replies
View Related
Apr 5, 2006
Hi Everyone,
We have a large and active MSSQL 2000 database. Recently, after a rebuild of the server, we had a problem with the SQL service SQLSERVERAGENT. The service could not start as the service account lost local permission to the registry. During this time, all of the data being sent to the database from our application accumulated into the database .ldf file. By the time we were able to get the service restarted, our .ldf file was approx. 28 Gigs. When the service restarded, the .ldf file shrunk down to regular size,about 40 megs, and the .trx tlog file grew up to 28 gigs for that specific period (new file every hour).
The problem is, the database file (database.mdf) stayed about the same as it was before the service was restarted. When the .ldf transfered to the .trn none of the 28 gigs of data got stored in the database. What does this mean? Perhaps with the service stopped the application using the db saw problems and did not commit the data making it all useless? Or is it possible that the data in the .trn log just needs to be forced to commit to the .mdf???
Is there any way to verify the data in the 28 gig .trn file and figure out if we should get it stored to the database? If yes, how would we go about verifying it, and after that how would we force it to commit to the .mdf file? Am I on the right track here or is it not as I see it??
Thanks!
Mike
View 4 Replies
View Related
May 7, 1999
i have performed all the steps for the replication there are two problems i encounytring
(i) how to check whether the replication is working or not
(ii) can replication on the subscribing server automatically create the table which publishing server is publshing
(iii)please tell me someother forums for sql server
waiting for reply
ashish bhatnagar
View 2 Replies
View Related
Feb 15, 2008
Hello All,
I have a database and I am trying to run a query against it, it returns the data fine, I just want it displayed differently. Here is the example; I am a novice at SQL I dabble here and there so any help would be great!
Base Code
Select LOA.Account0 as 'Account Name'
From local_accounts LOA
Where LOA.Account0 like '%Microsoft%'
Group by LOA.ACCOUNT0
Account Name
Win32_UserAccount.Domain='Microsoft',Name='Jason'
I would like the data to be displayed differently in my query. I would like just the domain user name to appear in the row.
Account Name
MicrosoftJason
Does anyone have example code of something like this.
View 1 Replies
View Related
Mar 7, 2008
my query is :
select * from category where parentid =6
this gives me all children of number 6, I wanted to select name of cat 6 as well.
Please help me out
View 12 Replies
View Related
Jun 17, 2004
1-8 bit columns in a table consume one byte of storage space. That sounds simple and efficient.
If a bit could only store two values, this would make sense. But, a bit can be one of three values: NULL, 0, 1.
How does a NULL-able bit column only consume the storage space of a regular 0/1 bit?
View 10 Replies
View Related