That sounds like a good option. However, how would I be able to determine the problematic row(s)? For example, we have a straight INSERT INTO... SELECT FROM statement. It may process up to 50,000 records. If only one is "invalid", how can I know which one it is (without writing a query that...
This is going to be far-fetched, I know, but my immediate supervisor has asked if it would be possible to return any record(s) that causes an error. I told him I would investigate, but I didn't think it was possible.
For example, if we have an INSERT statement to move 100,000 records into a...
I'm trying to work in some rollback procedures into a few stored procedures. I've set up the following code. However, when I set it up to fail on purpose, the rollback does not appear to be working (the USP_Write_To_Log is not firing). What am I doing wrong?
Thanks!
DECLARE @err INT
BEGIN...
I'll give COALESCE a shot. I'm just so used to using IsNull on the few database fields that we allow them on. Oh, and yeah, same principle applies for all fields I need to check against.
Thanks!
Apologies for the triple post here, but I think I may have stumbled upon my solution. Does this look right?
UPDATE a
SET a.PUSH_STATUS = 'U'
FROM HR_SRC a
INNER JOIN EMPLE_jlr b
ON a.Employee_ID = b.HMN_RSRC_ID
WHERE
IsNull(a.Previous_Badge_ID, '') <> IsNull(b.TEMP_ID, '')
Hi all,
I'm trying to write a data validating query in which existing data is checked against new data coming come. I'm then determining if I need to insert a new record or simply update one already existing. The insert records are good to go, but I can't get the update comparison to go. Here's...
For whatever reason the original business requirements were drawn, the business owners must be able to alter the table/data at any time. This is something that could easily be done if they knew how to use Views and/or Joins (or let us template the reports within the actual application), but...
Not a problem. Just didn't think I had enough to really make a benefit though.
So here is the first part of the original logic Stored Procedure (where the DROP/recreate is):
SET NOCOUNT ON
--------------------------------------------------------------
--DROP EXISTING PREPAID WORKING TABLE...
I have a set of permissions which can potentially apply to about 15 different tables. What I want to do is be able to call these permissions dynamically so that I don't have to split a block of logic into two Stored Procedures.
Basically, I have a block of logic in which a "working" table is...
Denis hit the nail on the head. If I knew the date stamp, I would be able to check for its existance as is. However, because the date stamp changes each day, and also because it is not always the current day, I need to be able to look for the file name, minus the last 9 characters. For example...
Hi all,
Preliminaries:
1) This is in a SQL Server 2000 DTS Package
2) The flat file is on the server itself (duh)
3) The flat file always has a date stamp appended to the end
4) The date stamp isn't always the date the file was FTP'd to the server
Question:
I need to be able to check for the...
Sorry, I can't find an edit button. I didn't realize that my Windows Clipboard didn't pick up my text. Here's what my post really SHOULD read:
Hi all,
I'm not really sure what to call my problem, so I will try to be as descriptive as possible. I'm trying to insert records to a new table using...
UPDATE manual_audits
SET manual_audit_system = ( case
when transaction_number in ('10', '14', '9292') then 'G'
when transaction_number in ('401', '202', '8258', '8282', '8217', '6060', '6061') then 'M'
end)
WHERE claims_id = cast(@mclaims_id as nvarchar(10)
the solution by vongrunt seems to work (testing the data to make sure now).
SQLBill - I understand where you're going with the temp tables. I will read in to it for sure! This is actually handled by a DTS package. The temp table is created, used, and dropped within the same step.
Hi all!!!
I have a main table (itof_operator) and a working table (#itoftemp). I want to update a field on the main table (itof_operator.operator_state) with a field on the temp table (#itoftemp.cost_center_number) where a field on both tables match (itof_operator.operator_id =...
Hi all!!!
I have a main table (itof_operator) and a working table (#itoftemp). I want to update a field on the main table (itof_operator.operator_state) with a field on the temp table (#itoftemp.cost_center_number) where a field on both tables match (itof_operator.operator_id =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.