-
ActiveX/vbscrpt and Transform Data Tasks
Date: 01/11/07
Keywords: database, sql
I've asked this question before in a vaguely similar form. Still beating my head against the problem when I get a few minutes free.
Is it possible to:
1. Set the destination table in a transform data task, and
2. Set up the transformations in a transform data task
...in an ActiveX Script task in the same DTS package (SQL Server 2000)? I've read a few extremely vague forum posts on a few disparate boards that make me believe this is possible. When I try the first, though, I always seem to modify the database name the package is pointing to, rather than the table within the database.
Function Main()
dim pkg
dim conTextFile
dim conSQLDest
dim stpEnterLoop
dim stpFinished
dim intLocation1
dim intLocation2
intLocation1 = instrrev(DTSGlobalVariables("gv_FileFullName").Value, "\")
intLocation2 = instr(DTSGlobalVariables("gv_FileFullName").Value, ".")
DTSGlobalVariables("gv_FileTableName") = Mid(DTSGlobalVariables("gv_FileFullName").Value, intLocation1+1, intLocation2-intLocation1-1)
msgbox "FileTableName: " & DTSGlobalVariables("gv_FileTableName").Value
set pkg = DTSGlobalVariables.Parent
set stpEnterLoop = pkg.Steps("DTSStep_DTSDataPumpTask_1")
set stpFinished = pkg.Steps("DTSStep_DTSActiveScriptTask_5")
set conTextFile = pkg.Connections("Text File (Source)")
set conSQLDest = pkg.Connections("SQLServerDestination")
' We want to continue with the loop only of there are more
' than 1 text file in the directory. If the function ShouldILoop
' returns true then we disable the step that takes us out of the package
' and continue processing
if ShouldILoop = True then
stpEnterLoop.DisableStep = False
stpFinished.DisableStep = True
conTextFile.DataSource = DTSGlobalVariables("gv_FileFullName").Value
conSQLDest.DataSource = "[XTend_Load].[dbo].[" & DTSGlobalVariables("gv_FileTableName").Value &"_JU]"
Msgbox "Destination: " & conSQLDest.DataSource
stpEnterLoop.ExecutionStatus = DTSStepExecStat_Waiting
else
stpEnterLoop.DisableStep =True
stpFinished.DisableStep = False
stpFinished.ExecutionStatus = DTSStepExecStat_Waiting
End if
Main = DTSTaskExecResult_Success
End Function
not even close to figuring out where to start with step 2...
thanks.
Source: http://community.livejournal.com/sqlserver/55376.html
-
SQL 2005 --> DB2 Bulk Loading
Date: 01/05/07
Keywords: database, sql
Hi all. Does anyone on this group have any experience in either Bulk Loading, ETL, or Replication between a SQL 2005 database and a DB2 database. There is a known problem with the translation of a VARGRAPHIC (db2 datatype) to SQL 2005, so I'm trying to find the best workaround for a datafile that is about 2 GIG. I know it's a long shot but I thought I'd holler. If I figure it out, I'll post my findings for benefit of the group.
Source: http://community.livejournal.com/sqlserver/55189.html
-
Aggregation 101.
Date: 12/29/06
Keywords: sql
I'm overlooking the absurdly obvious, and I realize it...
What, in T-SQL, is a way to do this:
sum(count(distinct claimno)) as claimcount,...
that does not involve getting this:
Cannot perform an aggregate function on an expression containing an aggregate or a subquery.
as a return message?
(I would like to keep this as one statement rather than using temp tables, cursors, or anything like that as an intermediary.)
TIA.
Source: http://community.livejournal.com/sqlserver/54789.html
-
Identity column vs Unique ID generated in C# assembly
Date: 12/12/06
Keywords: database, sql
x-posted to databases
As part of our current SQL setup we've got an extended proc that calls a C++ DLL to generate a unique id for all db calls. This unique id is use as a primary key on a logging table that is inserted into (along with user id, destination stored proc and any params) prior to running the users call. Also this unique id is added to the params list and passed on to the destinition stored procedure. Finally the logging table is updated with the return code of the call.
Unfortunately this DLL won't work under SQL 2005, therefore I'm rewriting as part of the upgrade. That isn't the problem. The problem is one of the DBAs asking why we just don't use an Identity column on the logging table. TBH I couldn't think of a reason why not, especially if we use SCOPE_IDENTITY rather than @@IDENTITY. The only reason I could think of is historical, ie the original developers didn't trust SQL Server to handle the load (the DLL has been used since at least SQL 6). Can you think of situation where the use of an Identity column would fail?
Source: http://community.livejournal.com/sqlserver/54552.html
-
Sql 2000 to 2005 learning curve
Date: 12/11/06
Keywords: sql
Hey all. I'm pretty experienced in Sql 2000 and have a task I could do in my sleep if I had that server. We currently have an Oracle server that we want to copy the data onto the SQL Server 2005 server. Had this been 2000, I'd put down a DTS Package, and call it a day. However, I don't see a section on DTS in SQL 2005. Online help mentions Integration Services, but I don't see that either.
My question is this: How do I create an Integration Services package similar to a DTS package, and where do I find that area of the server?
Thanks much!
Source: http://community.livejournal.com/sqlserver/54356.html
-
hi all
Date: 12/03/06
Keywords: sql
Hello,
This is my first time posting here. I'm pretty new at SQL but I think that I am learning. :) Anyway, I have a sort of issue that I am hoping someone can clarify for me.
At my job, I am trying to fix up a query someone else made, forcing it to have all unique "PSourceIDs." Obviously, I can get 2 of the same number if I select distincts and then have two entries with different values anywhere in the record. So, here is what I was trying to do, eventhough it fails when I run it:
drop table #NewTest
select distinct psourceid into #NewTest
from #Test T
select * from #NewTest
insert into #NewTest (Priority, COSupplierCode, Aging, AgingToNow)
select Priority, COSupplierCode, Aging, AgingToNow
from #Test T
where (T.psourceid = #NewTest.psourceid)
select * from #NewTest
Firstly, can I do this with temp tables, and secondly, if so, then where did my logic fail?
Source: http://community.livejournal.com/sqlserver/54245.html
-
SQL Server 2005: A database on a different drive?
Date: 11/22/06
Keywords: programming, database, sql
I think I know the answer to this, but I want to see if anyone has a different one...
I have a database (well, I have a spec, I'm not creating it until I know the answer to this question) I'd like to create on a flash drive. Is this possible? It seems to me that one has to create all databases from a given SQL Server instance in the same directory...
(Basically, I'd like to be able to access the database from four SQL Server instances on two different networks and one non-networked computer-- because those are the locations I'll be programming the front-end app.)
Source: http://community.livejournal.com/sqlserver/53898.html
-
Data Warehouse / Data Mart design guidelines
Date: 10/27/06
Keywords: sql
I have been working on a SQL Server 2000 project to generate/transform data so that we can upload it from our data warehouse [corporate-level] into another data warehouse [enterprise-level]. One of the big requirements for this project is that it's reliable, we are notified of errors, and that we can measure our processes. Does anybody know of any good online resources/articles that specifically discuss:
Measuring/monitoring SQL Server jobs?
Tips for writing robust stored procedures?
Other thoughts/ideas/discussion are welcome as well.
Source: http://community.livejournal.com/sqlserver/53745.html
-
two questions
Date: 10/24/06
Keywords: database, sql
Hi all, forgive me if these have already been asked a zillion times...
1. what is the SQL query for determining the primary key of a table? meaning, i know there is SOMEthing like this that I can do:
select primary_keys from information_schema where table_name = 'myTable'
...but I don't remember the right syntax. anyone?
2. i'm building my database on a destkop machine. later, i want to do an export that will INCLUDE a very complicated database diagram that i've drawn in Enterprise Manager. is that possible? is there a way to save out JUST the diagram in some format that can later be imported into antoher SQL server machine elsewhere?
thanks for your time.
Source: http://community.livejournal.com/sqlserver/53307.html
-
SQL Server 2000 -> 2005 Upgrade Costs
Date: 10/23/06
Keywords: database, sql, microsoft
x-posted all over
My division is looking at upgrading our SQL Servers from 2000 to 2005 within the next six months. The other day, my boss asked me if I could do some online research to try and find an "Upgrade Cost Estimate calculator" of some sort. From his business perspective, for any given number of factors such as # of database servers, database average size, # of objects, etc., could be punched into some kind of magical formula to output an estimated manhour cost. He figures that someone HAS to have done this sort of analysis already, and is hoping that I can find it.
Has anyone out there heard of or seen such a thing, whether it be an online estimator, a PowerPoint presentation, or even a speech from a Microsoft rep? Thanks in advance!
Source: http://community.livejournal.com/sqlserver/53179.html
-
a little green...
Date: 10/20/06
Keywords: sql, web, google
Hello I'm relatively new to SQL.
Do any of you know of some good websites regarding SQL queries? I've done a search on google but I haven't been too impressed with what I've seen so far.
Thank you for your help!
Source: http://community.livejournal.com/sqlserver/52793.html
-
Verifying Basic SQL Functionality
Date: 10/05/06
Keywords: database, sql
I've been asked by my manager to come up with a script to run before and after an upgrade of SQL server to verify that basic statements within SQL work before and after an upgrade. Here's what I came up with. Anyone else ever do something like this?
/*
SQL Standard Health Check
DBA : Amy Boyd
Date: 10/5/2006
This is a script that can be run prior to and after the upgrade of
SQL server components to verify basic functionality.
*/
set nocount on
select 'Server Name: ' + @@servername + ' at version: ' + @@version
use admin -- or any other test database you might have
select 'Testing a select of a few sysobjects from admin db...'
select * from sysobjects where id < 5
if @@error = 0
begin
select 'Select of sysobjects successful'
select ''
end
select 'Testing table creation'
create table test_upgrade ( message varchar(100))
if @@error = 0
begin
select 'Table creation successful'
select ''
end
select 'Testing Insert into Table'
insert into test_upgrade values ('Table Insert Works')
if @@error = 0
begin
select 'Insert successful'
select ''
end
select 'Testing Update of Table'
update test_upgrade set message ='Table Update Works'
if @@error = 0
begin
select 'Update of table Successful'
select ''
end
select 'Testing Delete from Table'
delete from test_upgrade
if @@error = 0
begin
select 'Delete from table successful'
select ''
end
select 'Testing Drop table command'
drop table test_upgrade
if @@error = 0
begin
select 'Drop of table successful'
select ''
end
use msdb
select 'Testing a select of a few sysobjects from msdb db...'
select * from sysobjects where id < 5
if @@error = 0
begin
select 'Select of sysobjects successful'
select ''
end
use master
select 'Testing a select of a few sysobjects from master db...'
select * from sysobjects where id < 5
if @@error = 0
begin
select 'Select of sysobjects successful'
select ''
end
select 'Retreiving list of databases from ' + @@servername
select * from sysdatabases
select ''
if @@error = 0
begin
select 'Getting disk space stats for ' + @@servername
exec xp_fixeddrives
select ''
end
select 'Basic SQL Operations are working. Do not forget to test start/stop of SQL Server and Agent.'
select ''
if @@error > 0
select 'There was an error executing the health check please verify output for resolution.'
Source: http://community.livejournal.com/sqlserver/52733.html
-
mutiple else ifnull in a formula?
Date: 09/20/06
Keywords: no keywords
hello,
i have a question regarding a Crystal Reports formula i'm attempting. this is the only community that seems applicable when searching in interest "crystal reports", but if you know of a better place for me to ask this, please direct me there.
anyway, my issue is this. i have 3 date fields. if only the 1st one is populated, i want the output to be "date field 1". if both the 1st and 2nd fields are populated, i want the output to be "date field 1" and "date field 2". if all 3 fields are populated, i want the output to be "date field 1", "date field 2" and "date field 3".
here is the formula i have right now. i've played around a lot with parenthese placement, and everything has generated errors so far. the formula date fields are just a ToText conversion of the date fields, as i thought text would work better in the concatenation.
If (isnull({datefield2})) then ({datefield1})
else if (isnull({datefield3})
then ({formuladatefield1}+" and "+{formuladatefield2})
else ({formuladatefield1}+", "+{formuladatefield2}+" and "+{formuladatefield3})
any help is appreciated. thanks in advance.
Source: http://community.livejournal.com/sqlserver/52411.html
-
ORDER BY clause in Views/inline functions in MS SQL 2005
Date: 09/07/06
Keywords: sql
Hi all.
There is a strange problem I found. I upgraded SQL Server 2000 to 2005, I am a novice there. It seems that Views and inline functions do not support ORDER BY clause (The Select clause of a view may contain ORDER BY clause, but it seems to be ignored when running). More specifically, let dbo.Table1 be a table with columns ID, Name and a dbo.View1 created as:
CREATE dbo.View1
AS
SELECT TOP (100) PERCENT ID, Name
FROM dbo.Table1
ORDER BY Name
Then, if I run the query:
SELECT * FROM dbo.View1
it gives me no ordering (by [Name] field, neither in Management studio, neither in client applications (ADO 2.8 is used), while there WAS ordering in the same query results in MS SQL 2000. To get ordering, I must write again
SELECT * FROM dbo.View1 ORDER BY Name
What's wrong here? (I tried to find something in documentation, but could not find any useful things. The only essential note was that ORDER BY clause can't be used in views and inline function unless TOP attribute is specified in SELECT clause. But I knew that :-) ).
Source: http://community.livejournal.com/sqlserver/52104.html
-
Reporting Services
Date: 08/29/06
Keywords: sql, hosting
How can I implement SQL Server Reporting Services in a shared hosting environment?
Source: http://community.livejournal.com/sqlserver/51812.html
-
MS SQL vs BDE
Date: 08/24/06
Keywords: cms, crm, sql
При включении в домен компьютеров обнаружил неприятную особенность:
CRM-продукт использует BDE для доступа к MS SQL. Сервак, как я уже говорил, управляется Windows 2003 Server. Подозреваю, что проблема в том, что MS SQL Server никак не виден никаким продуктам, на это способным и для этого, собственно, предназначенным. Собственно, доходит до того, что на уже установленном MS SQL невозможно подключить регистрацию СБД. Никак не могу понять, где я что сделал не так.
Вкратце, параметры:
Windows 2003 Server PDC
MS SQL Server 2000 + SP2003
SQL-sever включен в Active Directory
Попытка установить коннект с включенной в домен клиентской машины. В ODBC вполне успешно прописан этот самый сервер. А вот BDE при попытке подключиться к серверу утверждает, что сервер не найден или не существует.
Какие могут быть пути решения проблемы?
Source: http://community.livejournal.com/sqlserver/51617.html
-
Random number per row in INSERT...SELECT
Date: 07/25/06
Keywords: sql
Okay, here's one that's a bit beyond my SQL Server knowledge.
I need to generate a random number from 1 to n (where n is 2, 3, or 4) for a column being inserted into a table from a select from a temporary table.
INSERT INTO QA_Exam_QuestionsDetail (
EmployeeID, ExamID,
QuestionID, AnswerID,
OriginalAnswerID
)
SELECT
@EmployeeID, @examID,
QuestionID, Round((@Upper * Rand() + 1), 0),
B.AnswerID
FROM #tempSelectedQuestionTable A, QA_Answers B
WHERE A.QuestionID = B.QuestionID
I've removed a lot of stuff from this query, there are many other columns but those aren't important.
Yes, it's stupid that I have to use the AnswerID to key against another table, but need to at the same time randomize this ID so the display order is different for each session. No, we can't do it in the front end. It's Flash and even worse than this garbage.
Here are the problems:
- @Upper isn't actually a variable. It has to be counted from the table for each set of values that are keyed by their QuestionID. So...there could be data like this
QuestionID AnswerID
2 1
2 2
2
3
3
1
3
2
3
3
3
4
For both sets of rows, QuestionID 2 and QuestionID 3, the upper bound of the random value is different: 3 for QuestionID 2, and 4 for QuestionID 3. I guess this sounds like a nested select but I'm not sure how to write this. Usually there will be about 50 questions, so we're looking at up to 200 or so rows.
- I don't think RAND() returns a different value for every row, only once for the query. What are the alternatives?
Any ideas? I just want this project to end.
Source: http://community.livejournal.com/sqlserver/50919.html
-
VB9 and C#3
Date: 07/18/06
Keywords: xml
I have briefly examined language specifications for VB9 and C#3. I am correct to think that only VB9 has Deep XML Support, Nested Extension Methods, Nullable Types, Relaxed Delegates, Strong “Duck Typing”? Also, it is the case that only C#3 has Lambda expressions, Implicitly Typed Arrays, and Expression Trees?
Source: http://community.livejournal.com/sqlserver/50649.html
-
Textcopy in SQL 2005? (inserting BLOB/CLOB data)
Date: 06/21/06
Keywords: database, sql, microsoft
Hi folks. Anyone know if TEXTCOPY is still a viable utility in SQL Server 2005?
I've just installed SQL Server 2005 for the first time and I'm trying to populate a database using the same scripts and batch files that work fine for me in SQL2K. The batch files I use to insert BLOB and CLOB data use TEXTCOPY...and fail. On searching the SQL2005 folder hierarchy, I see no evidence of TEXTCOPY at all. I've tried general Googling, but have found no explicit mention on SQL2005 and TEXTCOPY (on way or the other) and, of course, TEXTCOPY is an undocumented utility to begin with :)
UNDER SQL2K: c:\program files\microsoft sql server\mssql\binn\textcopy
UNDER SQL2005: ???
If TEXTCOPY is no more, perhaps someone can recommend an alternate straightforward method of populating BLOB/CLOB data in SQL2005?
Cheers.
Source: http://community.livejournal.com/sqlserver/50041.html
-
one MS SQL Server position in Lombard, IL USA
Date: 06/20/06
Keywords: software, database, sql, security
Please email me directly: jason@froebe.net
these are permanent positions (sorry, no H1B visas) to be filled within a couple weeks. (Second job description is for MS SQL Server)
The group description didn't mention if job postings were allowed or not. Please let me know if they are ok or not.
Job posting #1:
===============
Sybase Database Administrator
Description
The database administrator for Sybase ensures the control and security of data and efficient use of system resources. Provides technical assistance to users. Develops methods to improve operational and production functions. Assists in the install of complex system software.
Essential Duties and Responsibilities
Sybase Replication Server – ongoing maintenance and setup for new servers as needed
As needed - SQL tuning advisory consulting and hand on trouble shooting for development team. Assists in new product development, implementation or enhancements.
Ongoing operational Sybase admin support for various applications
Sybase device and database performance and disk space allocation/ monitoring
Familiarity with DBArtsian for Sybase
Performs Disaster Recovery planning and testing.
Perform Sybase ASE 12.5.X Server installations, and version/patch upgrades
Experience, knowledge as SQL Server and/ or Oracle DBA is preferred.
On-call support as required (rotational)
Proactive attitude and passion for process improvement; scripting; issue resolution for internal and external customers
Able to take direction, switch priorities, and have tenacity to follow through on issues and see through resolution.
Reports to Team Leader on plans, projects, and problems.
Job Requirements
To perform this job successfully, an individual must be able to perform each essential duty. The requirements listed are representative of the knowledge, skill, and/or ability required
Experience with ASE performance tuning and monitoring.
Experience with Sybase ASE 12.X. and ASE 12.5.X versions and its new features
Education
Bachelor's Degree in Computer Science or equivalent. Minimum 4 years experience in data processing.
Job posting #2:
===============
SQL Server Database Administrator
Description
The database administrator for SQL Server ensures the control and security of data and efficient use of system resources. Provides technical assistance to users. Develops methods to improve operational and production functions.
Essential Duties and Responsibilities
SQL server replication – ongoing maintenance and setup for new servers as needed
As needed - SQL tuning advisory consulting and hand on trouble shooting for development team. Assists in new product development, implementation or enhancements.
Ongoing operational & development DBA support for various applications
Database performance and disk space allocation/ monitoring
Familiarity with DBArtsian, SQL Enterprise, etc.
Assists in the install of complex system software at client sites – as needed
Performs Disaster Recovery planning and testing.
Perform SQL 2000, 2005 SQL Server installations, and version/patch upgrades
Experience, knowledge as Sybase Server and/ or Oracle DBA is preferred.
Be able to travel (approx aggregated 1-3 weeks/ year)
On-call support as required (rotational)
Proactive attitude and passion for process improvement; scripting; issue resolution for internal and external customers
Able to take direction, switch priorities, and have tenacity to follow through on issues and see through resolution.
Reports to Team Leader on plans, projects, and problems.
Job Requirements
To perform this job successfully, an individual must be able to perform each essential duty. The requirements listed are representative of the knowledge, skill, and/or ability required
Experience with SQL Server performance tuning and monitoring.
Experience with SQL Server 2000, 2005 versions and its new features
Education
Bachelor's Degree in Computer Science or equivalent. Minimum 4 years experience in data processing.
Source: http://community.livejournal.com/sqlserver/49739.html