An Odd Quandry.
May 3, 2006
So I've set up 3 tables for some recursive data verification for an
object link embedding procedure.
Basically importing filenames.
The three fields in question are identical.
Document_link.key2_value
document_link_staging.key2_value
document_link_storage.key2_value
And these three fields are populated from a substring of the filenames
which are generated in another table.
Filenametbl.pickno
here is the rub.
If I have 100 identical records in the document link tables with
key2_values that are in Filenametbl, and three hundred records in
Filenametbl, then this query:
select * from Filenametbl where pickno not in (select key2_value from
document_link_staging) and pickno not in (select key2_value from
document_link_storage)
should return 200 records.
It returns 0 records.
So while this query:
select * from Filenametbl where pickno not in (select key2_value from
document_link_staging)
returns 200 records in this scenario,
this query returns 0:
select * from Filenametbl where pickno not in (select key2_value from
document_link_storage)
I am trying to figure out why that is, as the casting for the
key2_values is exactly the same (varchar(255))
Can anybody tell me how to remedy this sort of thing, as its been
bugging me for about 2 months.
I've been able to work around it, but what it is... is just terribly
ineffiecient.
View 4 Replies
Sep 25, 2002
Here is the situation.
I am currently truncating a table, and then importing the data that I need (Using DTS). The way that I have it setup is I first Truncate my table, then I connect to the Server at our corporate HQ's and import the data that I need.
The problem that I haven't had yet, but may in the future is that, what if the server at HQ is down, or the database that I am getting data from is not available for whatever reason?
I think what I need to do is add a step that first makes sure that the database is available, then go ahead and truncate the table, and finally import the data, but I am not sure how, or what I need to do. Please help.
Thanks in advance
Troy
View 1 Replies
View Related
Jul 20, 2004
Hi y'all!
I have a table (Portfolio) with the following columns:
1)PortfolioID
2)StockID
3)Date
Interestingly enough, I also have a second table (stock) with the following columns:
1) StockID
2) Date
The relationship I am trying to enforce is one in which the Portfolio table is made up of many stocks, and the Stock table rows can be components of many Portfolios. Many-To-Many in that respect (OMG! Am I enforcing an orgy-type relationship? ;) )
My Portfolio PK is all three columns. My Stock PK is both columns. Obviously both tables contain other data, but that isn't necessary to figure stuff out here, I don't think.
My portfolio table defines portfolios that consist of multiple stocks. However, the Stock table will never have a duplicate stockID on any given date. The reasoning here is that a stock's data (the "other stuff" in the stock table) won't change from portfolio to portfolio, since the smallest unit is a stock, and that stock's performance data for a given date will be the same regardless of how many portfolios it may be a part of.
On the other hand, a portfolio MAY consist of multiple instances of the SAME or different stocks.
Many-To-Many
Attempting to add a FK constraint where the primary key table is STOCK, and the FK table is PORTFOLIO was my way of attempting to enforce at the DB level that there is only ONE of a given stock (defined as a distinct StockID and Date pair) for each day, but it can be associated with one-to-many PORTFOLIOs. The FK is StockID and Date.
It all seemed so simple... :( but of course, since I create my portfolio before the STOCK rows associated with it (stock rows are only created as needed, based on the portfolio rows that define the stock list that makes up the portfolio), the FK constraint fails (no primary key row exists when the FK row is created).
It bothers me to remove the constraint, even though I know I must...
How would one go about enforcing this type of relationship? What I really want is the constraint to reverse the PK and FK tables...but the STOCK table's columns are a subset of the PORTFOLIO table's primary key...so I can't do it that way (error due to PORTFOLIO's columns not being THE PK or having a unique constraint (which they cannot have, since the same StockID/Date can exist in more than one PORTFOLIO.
Any thoughts from anyone able to stay awake and interested by this time?
Thankspaul
View 2 Replies
View Related
May 31, 2007
In the file connection manager, how do I specify a dynamic file name, using a variable?
Such as:
"c:myDir" + @[User::FileName]
When I attempt to do this, it says it's not valid. I certainly hope there is a way to do this!
Thanks
View 9 Replies
View Related