Deleteing Millions Records From A Table-faster Way?

Jun 21, 2007

hi!
i am using sql 2005 k with sp1.

I want to delete 30-40 million rows from a transactional table. Whats the fastest way to delete these rows. just to delete 300,000 rows it takes 30 min. also i don't want to truncate the table.

any help would be appreciated

Thanks

View 9 Replies


ADVERTISEMENT

Deleteing Duplicate Records From My Table

Jul 20, 2005

I just discovered that all my records appear twice inside my table, inother words, they repeat on the row below. How can I delete all of theduplicates? I'm sure there must be a tidy line of sql to do that.Thanks,Bill

View 1 Replies View Related

DTS That Does HouseHolding With Millions Of Records

Sep 3, 2006

Hi all,I was given a task to create a houseHolding logic under a table thathave millions records.first let me explain what is a house holding:let's say I have 2 records that have the same phone number, that meanthat both records are under the same household, but this can get morecomplicatedthis article explain ithttp://www.teradata.com/t/page/115924/index.htmlif anyone worked with household he knows that you need to scan thetable many time to get all the house holds, I used a dts to do it.I tested the dts on 11 records like the article did and that workgreat, but once I went to million records each loop is taking me 2 houror so....a and I have no idea how how many loops I will have to do.if anyone out there worked with household queries and used sql, yourimput would help me allotthanks.

View 3 Replies View Related

Migration Millions Of Records

Aug 19, 2007

Hi

Please guide me for the below given problem.


While doing migration by using cursors for the below given sample data its taking more hours to complete the process. Therefore want to know is there any way I can do it in simple query.


ACNo Amount Balance CalType
A001 10 10 +
A001 10 20 -
A001 40 40 +
A001 10 30 -
A002 90 90 +
A002 20 110 +
A002 40 150 +
A003 10 30 +
A003 10 40 +
A003 10 30 -
A004 40 40 +
A004 10 30 -


Iam having Amount value alone and Balance has to be calculated value based on CalType. At the same time the Balance has to be reset as 0 when AcNo has changed.


Please guide me for the faster approach.


Regards,
Mohanraj

View 3 Replies View Related

How Can I Take Millions Of Records Without Time Out Error?

Sep 19, 2007

Hi,There are about 30 millions records on my mssql server and I want to access 2 million of them at one time.  However, when I try to access with sql command I get time out error. I want to select first 100 record and select the other 100 and so on. May I obtain this?For example;select * from tbl_Customer where name = @name_  ->time out errorSomeone has said that you can solve this problem with < cursors > but I can't find enough article. Thanks... 

View 3 Replies View Related

Which Is The Fastest Way To JOIN Having Millions Of Records?

Mar 15, 2004

If there is 13 million records in one table and 40 thousand records in another table then what is the fastest way of joining these two tables????

This was a question to me from somebody to which i cudn't answer back properly. Cud anybody tell the answer with properreasons behind the answer??????

Thanx.

View 7 Replies View Related

Query To Delete Millions Of Records

Jul 23, 2012

i have a query to delete millions of records. I whant to delete in batches of a 1000. My Select join statement will return millions of records so this takes alot of time how to i select a 1000 records delete everything that his not in those record and loop and not select the same records again.Here is what i have :

DECLARE @i INT
WHILE (1=1)
BEGIN
BEGIN TRAN
DELETE TOP(1000) FROM dbo.ABC123
WHERE SUBSTRING(dumbdumb,1,8) NOT IN

[code]....

View 3 Replies View Related

25 Millions Records Insert ,takes More Than 3 Hrs

May 14, 2008

Hi Teachies,

I am using SQL Server Standard Edition .

in one of my table , there i am inserting around 25 millions records and that takes time around more than 3 hrs.

same thing is happening while fetching records from that table.

this database contains only single file group i.e primary

and that table contains .. Clustered as well as non clustered index.

it doesnot have any Triggers.

How do i increase this performance.

Paritioning of table cannot be use in SQL Server Standard Edition.

Or Dropping all non clustered index before insert operation will improve my performance.

Please suggest me.

Thanks

Rajesh Varma

View 2 Replies View Related

Millions Records Archiving And Delete

Feb 27, 2007

The iussue:Sql 2KI have to keep in the database the data from the last 3 months.Every day I have to load 2 millions records in the database.So every day I have to export (in an other database as historical datacontainer) and delete the 2 millions records inserted 3 month + one day ago.The main problem is that delete operation take a while...involvingtransaction log.The question are:1) How can I improve this operation (export/delete)2) If we decide to migrate to SQL 2005, may we use some feature, as"partitioning" to resolve the problems ? In oracle I can use the "truncatepartition" statement, but in sql 2005, I'm reading, it cant be done.This becouse we can think to create a partition on the last three mounts tosplit data. The partitioning function can be dinamic or containing afunction that says "last 3 months ?" I dont think so.May you help usthank youMastino

View 5 Replies View Related

Comparing Millions Of Records From File A And B

Sep 11, 2006

I'm trying to compare about 28 million records (270 length) from table A and B using the Lookup task as described in this forum. The process works fine with about two million records or so on my desktop ( p.4 3.39GHz, 1.5 GB Ram), but hangs with the amount of data I'm trying to process. I tried using full and partial caching, but to no avail. I'm thinking this is a hardware resource problem. So, does anyone has any recommendation on the hardware needed for this kind of operation and/or suggestion? Thanks in advance...

View 8 Replies View Related

Querying 9.5 Millions Records With No Primary Key

Sep 4, 2007



Hello all
quick question-- Im looking for the most effiecient way to extract data daily from a table with some 9.5 mill records and growing. These are transaction records and ideally I would like to bring over the last days transactions and add them to my existing table. I cannot use the transaction date as sometime we have to operate in an "Offline" mode where the records are brought over sometime later. This could be days are unfortunetaly a week or more. there are some 30 fields in the transaction table so is there a more efficient way to do this simply creating a concatenated key?? Would it be more effiecient to drop and recreate the table daily? that sounds extreme so wanted to get a few ideas.


Thanks in Advance

km

View 2 Replies View Related

Inserting 25 Millions Records SQL Server Takes 3hr

May 19, 2008

Hi Teachies,



I am using SQL Server Standard Edition with good HardWare configuration.

In one of table i am inserting around 25 millions records and that takes time around more than 3 hrs.

same thing is happening while fetching records from that table.

this database contains only single file group i.e primary

and that table contains .. Clustered as well as non clustered index.

it doesnot have any Triggers.

How do i increase this performance.

Paritioning of table cannot be use in SQL Server Standard Edition.

Or Dropping all non clustered index before insert operation will improve my performance.

Please find the details ..

SERVER CONFIGURATION:

Intel pentium (R) 4 CPU
2.88 GHZ,
2.79 GHZ ,2 GB RAM

Operating System: WINDOWS 2003 R2 STANDARD SERVICE PACK 2



Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)

Oct 14 2005 00:33:37

Copyright (c) 1988-2005 Microsoft Corporation

Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)





DAtABASE DETAILS:


MDF and LDF located on C: Drive

Available Space on C: DRIVE 2.94 GB




TABLES DETAILS

CREATE TABLE [dbo].[TIX_PAYMENT_SCHEDULE](

[PaymentScheduleId] [bigint] IDENTITY(1,1) NOT NULL,

[OwedAmountId] [int] NULL, --NonClusteredIndex

[ProposalId] [int] NOT NULL, --NonClusteredIndex

[BrandId] [int] NULL, -- NonClusteredIndex

[DueDate] [datetime] NULL, --NonClusteredIndex

[OverdueDate] [datetime] NULL,--NonClusteredIndex

[ExpectedAmount] [decimal](18, 2) NULL,

[TransactionStatusId] [tinyint] NULL,--NonClusteredIndex

[IsLate] [char](1) NULL,

[IsPaymentReceived] [char](1) NULL,

[ScheduleBatchJournalId] [bigint] NULL,--NonClusteredIndex

[IsValidSchedule] [char](1) NULL,

[RuleId] [int] NULL,

[ActionId] [int] NOT NULL,

[ReasonId] [tinyint] NULL,

[Comments] [nvarchar](2000) NULL,

[NoofDays] [int] NULL,

[ActualAmountReceived] [decimal](18, 2) NULL,

[CreatedBy] [uniqueidentifier] NULL,

[CreatedDateTime] [datetime] NOT NULL,

[LastUpdatedBy] [uniqueidentifier] NULL,

[LastUpdatedDateTime] [datetime] NOT NULL,

[CaseScheduleId] [bigint] NULL,--NonClusteredIndex

[ActionDate] [datetime] NULL,

[HasExactMatch] [char](1) NULL,

[IsCatchupBalanced] [char](1) NULL,

[HasModified] [char](1) NULL,--NonClusteredIndex

[PendDate] [datetime] NULL,

[IsAutoAccept] [char](1) NULL,

[CatchupBalanceIdentifier] [uniqueidentifier] NULL,--NonClusteredIndex

CONSTRAINT [PK_TIX_PAYMENT_SCHEDULE] PRIMARY KEY CLUSTERED

(

[PaymentScheduleId] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]



TABLE 2



CREATE TABLE [dbo].[TIX_PAYMENT_CASE_SCHEDULE](

[CaseScheduleId] [bigint] IDENTITY(1,1) NOT NULL,

[ProposalId] [int] NOT NULL,--NonClusteredIndex

[DueDate] [datetime] NOT NULL,

[OverDueDate] [datetime] NOT NULL,

[TotalExpectedAmount] [decimal](18, 2) NOT NULL,

[TotalActualPaymentReceived] [decimal](18, 2) NOT NULL,

[TransactionStatusId] [int] NOT NULL,--NonClusteredIndex

[ActionId] [int] NULL,

[CreatedBy] [uniqueidentifier] NULL,

[CreatedDateTime] [datetime] NULL,

[LastUpdatedBy] [uniqueidentifier] NULL,

[LastUpdatedDateTime] [datetime] NULL,

[IsValidSchedule] [char](1) NULL,

[ScheduleBatchJournalId] [bigint] NULL,

[IsCatchupBalanced] [char](1) NULL,

[HasModified] [char](1) NULL,--NonClusteredIndex

[CatchupBalanceIdentifier] [uniqueidentifier] NULL,

CONSTRAINT [PK_TIX_PAYMENT_CASE_SCHEDULE] PRIMARY KEY CLUSTERED

(

[CaseScheduleId] ASC

)WITH (PAD_INDEX = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

GO



STORED PROCEDURE:





CREATE PROC [dbo].[TIX_PRC_GENERATE_PAYMENTSCHEDULE_DATA]
(
@XMLParams XML,
@ToDate datetime,
@HasModified char(1)

)
AS
BEGIN
SET NOCOUNT ON
--Exception Handling Variable Declaration
DECLARE @ErrorMessage NVARCHAR(200),
@ErrorNumber INT,
@ErrorSeverity INT,
@ErrorState INT,
@ErrorProcedure NVARCHAR(50),
@ErrorLine INT,
@ErrorDesc NVARCHAR(100)

DECLARE @XMLPayment INT
BEGIN TRY
IF @XMLParams IS NOT NULL
BEGIN --BEGIN IF


SET @ErrorDesc='Error Occured While Inserting into TIX_PAYMENT_SCHEDULE FROM XML'

INSERT INTO TIX_PAYMENT_SCHEDULE
(
OwedAmountId,
ProposalId,
BrandId,
DueDate,
OverdueDate ,
CreatedDateTime,
LastUpdatedDateTime,
ExpectedAmount,
ActualAmountReceived,
ScheduleBatchJournalId,
RuleId,
TransactionStatusId,
ActionId,
IsLate,
IsPaymentReceived ,
IsValidSchedule,
--Added by DC : 119
IsCatchupBalanced,
CatchupBalanceIdentifier,
HasModified
---------------------------------------------------
)
SELECT
Main.ELEMENT.value('(OwedAmountId)[1]','int') AS OwedAmountId,
Main.ELEMENT.value('(ProposalId)[1]','int') AS ProposalId,
Main.ELEMENT.value('(BrandId)[1]','int') AS BrandId,
convert(datetime,Main.ELEMENT.value('(DueDate)[1]','varchar(100)')) AS DueDate,
convert(datetime,Main.ELEMENT.value('(OverdueDate)[1]','varchar(100)')) AS OverdueDate,
@ToDate AS CreatedDateTime,
@ToDate AS LastUpdatedDateTime,
convert(decimal(18,2),Main.ELEMENT.value('(ExpectedAmount)[1]','varchar(100)')) AS ExpectedAmount,
convert(decimal(18,2),Main.ELEMENT.value('(ActualAmountReceived)[1]','varchar(100)')) AS ActualAmountReceived,
Main.ELEMENT.value('(ScheduleBatchJournalId)[1]','bigint') AS ScheduleBatchJournalId,
Main.ELEMENT.value('(RuleId)[1]','int') AS RuleId,
Main.ELEMENT.value('(TransactionStatusId)[1]','int') AS TransactionStatusId,
Main.ELEMENT.value('(ActionId)[1]','int') AS ActionId,
Main.ELEMENT.value('(IsLate)[1]','char(1)') AS IsLate,
Main.ELEMENT.value('(IsPaymentReceived)[1]','char(1)') AS IsPaymentReceived,
Main.ELEMENT.value('(IsValidSchedule)[1]','char(1)') AS IsValidSchedule

--Added by DC for 119

,Main.ELEMENT.value('(IsCatchupBalanced)[1]','char(1)') AS IsCatchupBalanced
,Main.ELEMENT.value('(CatchupBalanceIdentifier)[1]','nvarchar(1000)') AS CatchupBalanceIdentifier
,@HasModified
---------------------------------------------------------------------

FROM @XMLParams.nodes ('(/ROOT/DATA)') AS Main(ELEMENT)

END--END IF


END TRY--Main END TRY
BEGIN CATCH --Main BEGIN CATCH



SELECT @ErrorMessage = @ErrorDesc+Char(13)+Error_Message(),
@ErrorSeverity = Error_Severity(),
@ErrorState = Error_State(),
@ErrorNumber = Error_Number(),
@ErrorProcedure = Error_Procedure(),
@ErrorLine = Error_Line()
RAISERROR(
@ErrorMessage,
@ErrorSeverity,
@ErrorState,
@ErrorNumber,
@ErrorProcedure,
@ErrorLine
)
END CATCH --Main END CATCH
END --Main END





STOREDPROCEDURE 2



CREATE PROCEDURE [dbo].[TIX_PRC_GET_PAYMENTSCHEDULE_SCHEDULE_FOR_DATE_RANGE]
(

@ToDate datetime,
@IsValidSchedule char(1)

)
AS
BEGIN
SET NOCOUNT ON

--Execption Handling Variable Declaration
DECLARE @ErrorMessage NVARCHAR(200),
@ErrorNumber INT,
@ErrorSeverity INT,
@ErrorState INT,
@ErrorProcedure NVARCHAR(50),
@ErrorLine INT,
@ErrorDesc NVARCHAR(100)


BEGIN TRY --Exception Handling
SET @ErrorDesc='Error Occured while fetching records from TIX_PAYMENT_SCHEDULE'


SELECT
PaymentScheduleId,
OwedAmountId,
ProposalId,
DueDate,
OverdueDate,
ExpectedAmount,
TransactionStatusId,
IsPaymentReceived,
IsLate,
ActionId,
ActualAmountReceived,
IsValidSchedule,
BrandId,
CaseScheduleId,
ReasonId,
Comments,
NoOfDays,
ActionDate,
IsCatchupBalanced,
CatchupBalanceIdentifier,
HasModified
from TIX_PAYMENT_SCHEDULE with (nolock)
WHERE DUEDATE <=@ToDate AND IsValidSchedule=@IsValidSchedule


SELECT DISTINCT OwedAmountId,proposalId,brandId from TIX_PAYMENT_SCHEDULE with (nolock) WHERE DUEDATE <=@ToDate AND IsValidSchedule=@IsValidSchedule Order By OwedAmountId,ProposalId,BrandId asc
SELECT DISTINCT ProposalId from TIX_PAYMENT_SCHEDULE with (nolock) WHERE DUEDATE <=@ToDate AND IsValidSchedule=@IsValidSchedule Order By ProposalId asc


END TRY
BEGIN CATCH
SELECT @ErrorMessage=@ErrorDesc+CHAR(13)+ Error_Message(),
@ErrorNumber=Error_Number(),
@ErrorState=Error_State(),
@ErrorProcedure=Error_Procedure(),
@ErrorLine=Error_Line(),
@ErrorSeverity=Error_Severity()

RAISERROR(
@ErrorMessage,
@ErrorSeverity,
@ErrorState,
@ErrorNumber,
@ErrorProcedure,
@ErrorLine
)

END CATCH

END





Thanks & Regards

Rajesh Varma

View 6 Replies View Related

25 Millions Records Insert Operations Takes Around More Than 3 Hrs

May 14, 2008

Hi Teachies,


I am using SQL Server Standard Edition with good HardWare configuration.

In one of table i am inserting around 25 millions records and that takes time around more than 3 hrs.

same thing is happening while fetching records from that table.

this database contains only single file group i.e primary

and that table contains .. Clustered as well as non clustered index.

it doesnot have any Triggers.

How do i increase this performance.

Paritioning of table cannot be use in SQL Server Standard Edition.

Or Dropping all non clustered index before insert operation will improve my performance.

Please suggest me.

Thanks

Rajesh Varma



View 17 Replies View Related

Accessing 2 Millions Records Using Full Text Searc

Apr 25, 2008

Hi,
My full text search on 2 millions records is taking time to show the result.
I have created full text catalog in RAM drive to make the retrival process faster.
But still its taking more than 1 minute to get the matching pattern.
I am using SQL server 2005. I have 2 columns (id,text) in my table..

This is my unique index script

USE [SAMPLE]
GO
CREATE UNIQUE NONCLUSTERED INDEX [ui_productid] ON [dbo].[Products]
(
[id] ASC
)WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY]..

This is my primary key index script..
USE [SAMPLE]
GO
ALTER TABLE [dbo].[Products] ADD CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY]..

This is my query..

SELECT D.[id], D.productname
FROM dbo.Products AS D
WHERE CONTAINS(productname, 'ford')

What should i do to show the result in 3-4 seconds.

View 1 Replies View Related

SQL 2012 :: Accurate Sorting Data Each Time With Millions Of Records Without Time Field?

Apr 25, 2014

Sample Table

USE [Testing]
GO
/****** Object: Table [dbo].[Testing] Script Date: 4/25/2014 11:08:18 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

[Code] ....

It seems to work fine with one million records.

Each primary key is unique, but the begindate is non-unique, and i guess even if i use datetime2 and add nanoseconds, from what i have read, there is a chance that i could have a duplicate datetime since the date is imported via XML from multiple sources.

View 7 Replies View Related

Inserting Millions Of Rows Into A Table

Aug 10, 2006

Hi,

I have a DataTable in memory and I want to write a C# code to dump the data into a SQL database. Is there a faster way of dumping millions of rows into a SQL table besides running INSERT INTO row by row?

Thank you,

Jina

View 3 Replies View Related

Truncate A Huge Table Having 21 Millions Of Rows

Nov 19, 2015

SQL Server: 2008 R2

Question A :  I need to truncate a table, it has 21 millions of rows and it has a size of 14 GB.             

                                1-  How do I find out if this table is not being referenced by a FOREIGN KEY?
                                2-  Does it Participates in a indexed view?
                                3- Is being published by using transactional replication or merge replication?

Question B:  How do I safely truncate that table? 

View 8 Replies View Related

SQL 2012 :: Data Size Of Table Is Not Reduced Even After Deleting Millions Of Rows

Sep 21, 2015

I have deleted nearly 30 million rows from a table. But however when I used the sp_spaceused command to calculate the data occupied by the table I don't see any difference in the data size of the table. In fact the data has increased to few MBs after the deletion, but not much.

View 8 Replies View Related

Temp Table Faster?

Dec 23, 2005

If you were doing paging of results on a web page and were interestedin grabbing say records 10-20 of a result set. But also wanted to knowthe total # of records in the result set (so you could know the total #of pages in the set).Would it be better to query the DB table 2X. Once for Count(*). Andagain for the records for the current page?Or better to create a temp table, select the records into it, and thenget count(*) and the page results from the temp table?I saw an example in a book that made a temp table to do this and to meit seemed like it would be slower. I don't get the reason for a temptable. Anyone have any ideas?

View 5 Replies View Related

Faster Way To Import/append Data To Table...

Dec 13, 1999

Hello,

I was wondering if there was a different approach I should take in appending data to a table...

My destination table has about 94+ million records in it, and I have been taking two approaches to getting new files into this table:

1) I do a data pump task in a DTS to import the file to a trans (temp) table, which is truncated every time, and then do an INSERT INTO statement from the temp table to my destination table.

The import to the trans table only takes a few minutes (about 1 - 2 million records per file, but have short record lenghts,) but when I do the INSERT INTO statement, it takes upwards of 6 hrs to append.

2) I have tried doing a bulk insert task, going directly to the destination table (which defeats the purpose of my trans table to check out the data prior, but I feel the data is clean at this point.)

I am running the bulk insert right now, and it's been running for over 3 hours...so I'm going to assume this will take just as long as the INSERT INTO statement does like I did before.

My destination table does not have any indexes in it at all, and I don't need to do any transformations to the data when bringing it into SQL since the data is clean. Also, I have a default value constraint on one of my fields on the destination table.

Plus there are other ppl and applications hitting the server which could impact the overall processing, but nothing out of the ordinary is going on the server today. I know there are only so many ways to get a file into a table...but maybe someone knows a different way I should try this.

Thanks for anyone's suggestions!

Kael.

View 1 Replies View Related

Why Is DTS Faster Than A Query To Load A Remote Table?

Apr 23, 2007

Hello

DTS is notoriously faster than making the following statement:

insert into synonym_MyRemoteTable
select * from myLocalTable

Why is it so?

Thanks a lot.

View 6 Replies View Related

Problems Deleteing

Aug 9, 2006

Hello all.

I am using the following statement to establish which rows have duplicate information using the following statement:


SELECT EMPLOY_REF, SAL_DATE FROM @TEMP_TABLE GROUP BY EMPLOY_REF, SAL_DATE HAVING COUNT(*) > 1


Once i have established these rows I want to delete them from the table. The code i had thought about (but QA doesnt like it) was:


DELETE FROM @TEMP_TABLE
WHERE EMPLOY_REF AND SAL_DATE IN (SELECT EMPLOY_REF, SAL_DATE FROM @TEMP_TABLE GROUP BY EMPLOY_REF, SAL_DATE HAVING COUNT(*) > 1)

Can anyone suggest a way to go about this? Thanks people :)

View 8 Replies View Related

13GB MySQL Table...Processing Queries Faster...

May 23, 2007

I have a 13 GB MYSQL table with the following definition:


Code:


CREATE TABLE `WikiParagraphs` (
`ID` int(10) unsigned NOT NULL auto_increment,
`Paragraph` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=73035281 ;



I query it like this:


Code:

select Paragraph from WikiParagraphs where ID in (1,2,3,4)



the 1,2,3,4 bit comes from the Sphinx FullText engine that gives me the IDs I need that match my query within about 500 milliseconds.

But retrieving the data itself takes approximately 3-6 seconds.

Obviously, I'd like to speed this query up.

Any ideas?

G-Man

View 1 Replies View Related

Help With Deleteing From Two Linked Tables

Mar 24, 2008

Hi,
know this sounds like a really silly question, but im having a bit of a problem deleting from two linked tables
I have tried doing the following, however it says that it has an error near the ','
Any suggestions??
DELETE FROM meter_quote , client_details FROM meter_quote, client_details INNER JOIN client_details ON meter_quote.Client_ID = client_details.Client_ID
Thanks, Hayley

View 2 Replies View Related

Deleteing Large Bulks Of Data

Feb 2, 2006

Brief background:We are using SQL Server 2000, and one of the tables stores usersessions details (each time our users logs into our system we insert anew record in the session table, and each time user logs out from oursystem we insert another record in the same table).SESSION_ID is the primary key and it is clustered index.The system produces 5 million session records/day.The problem:Each day we transfer the session data (delta only) to other machine andwe want to delete bulk of ~5 million sessions. This should happendwithout any interfering of our customers activity ( in the same time,we should not block the table - new sessions should be created).What is the best way to perform such task ?

View 4 Replies View Related

Error Deleteing Remote File

May 16, 2007

I am trying to delete a remote file as part of an SSIS package. The FTP Task I have to retrieve the file works fine. I use the same remote path variable and connection manager for both tasks. However, when the delete step executes I receive the error:



Error: 0xC002918E at FTP Task, FTP Task: Unable to delete remote files using "FTP Connection Manager 1".

View 11 Replies View Related

How To Automatically Create New Records In A Foreign Table When Inserting Records In A Primary Table.

Sep 13, 2006

Ok, I'm really new at this, but I am looking for a way to automatically insert new records into tables.  I have one primary table with a primary key id that is automatically generated on insert and 3 other tables that have foreign keys pointing to the primary key.  Is there a way to automatically create new records in the foreign tables that will have the new id?  Would this be a job for a trigger, stored procedure?  I admit I haven't studied up on those yet--I am learning things as I need them. Thanks. 

View 4 Replies View Related

SQL Server 2014 :: Selecting Records From Table 2 While Counting Records In Table 1

Aug 11, 2015

Table1 contains fields Groupid, UserName,Category, Dimension

Table2 contains fields Group, Name,Category, Dimension (Group and Name are not in Table1)

So basically I need to read the records in Table1 using Groupid and each time there is a Groupid then select records from Table2 where Table2.Category in (Select Catergory from Table1)
and Table2.Dimension in (Select Dimension from Table1)

In Table1 There might be 10 Groupid records all of which are different.

View 9 Replies View Related

Transact SQL :: Retrieve All Records From Parent Table And Any Records From Child Table

Oct 21, 2015

I am trying to write a query that will retrieve all students of a particular class and also any rows in HomeworkLogLine if they exist (but return null if there is no row). I thought this should be a relatively simple LEFT join but I've tried every possible combination of joins but it's not working.

SELECT
Student.StudentSurname + ', ' + Student.StudentForename AS Fullname,
HomeworkLogLine.HomeworkLogLineTimestamp,
HomeworkLog.HomeworkLogDescription,
ROW_NUMBER() OVER (PARTITION BY HomeworkLogLine.HomeworkLogLineStudentID ORDER BY

[Code] ...

It's only returning two rows (the students where they have a row in the HomeworkLogLine table). 

View 3 Replies View Related

Select * From Table Is Processed Much Faster Than Select MyField From Table ¿?¿?

Oct 1, 2007



I have a query that has the following structure

Select *
From Table
Where Condition And ... (some 'Exists' conditions)

When I run the query using field names the query gets much slower, and I cannot understand Why!


Select MyField
From Table
Where Condition And ... (some 'Exists' conditions)


I'm talking about three times slower using the Select MyField sintax.

Any ideas???

View 8 Replies View Related

Deleteing Columns From A Saved Fixed Width File Connection Object

Jun 12, 2006

How do I delete columns in a fixed width column file connection object, after I've saved it I can't remove columns anymore?

View 1 Replies View Related

How Do I Select All Records In One Table That Have NO Related Records In Another Table?

Jul 20, 2005

I can't get my head around this:I want to select all IDs from table A that do not have a related record intable B according to some condition:Table A contains, say, Parents and table B contains Children. I want toselect all Parents that have no children called "Sally" (this is a noddyexample, reminds me of being at Uni again :) ).Any ideas?Thanks

View 2 Replies View Related

Deleting Old Records Is Blocking Updating Latest Records On Highly Transactional Table

Mar 18, 2014

I have a situation where deleting old records is blocking updating latest records on highly transactional table and getting timeout errors from application.

In details, I have one table called Tran_table1 in OLTP database. This Tran_table1 is highly transactional table, it will receive data for insert/update continuously

While archiving 2 years old records from Tran_table1 into Tran_table1_archive in batches(using DELETE OUTPUT INTO clause), if there is any UPDATEs on Tran_table1,these updates are getting blocked and result is timeout errors in application.

Is there any SQL Server hints to avoid blocking ..

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved