Insertion And Updates On 20.000.000 Tuples Table.
Jun 23, 2006
Hi,
I have a table with 20.000.000 of tuples.
I have been monitoring the performance of the insertion and updates,
but not convince me at all.
The table have 30 columns, what and 12 of it, are calcultated column.
The test that i do was this:
1 Insertion with all the columns and calculing the calcultated columns
in the insertion sentence.
1 insertion and all the columns calculated in @vars..
1 insertion with the basic fields, and 10 updates.
And the result was that the last test was the most performant.
What is your opinion?
View 4 Replies
ADVERTISEMENT
Oct 30, 2007
Hi...
I have data that i am getting through a dbf file. and i am dumping that data to a sql server... and then taking the data from the sql server after scrubing it i put it into the production database.. right my stored procedure handles a single plan only... but now there may be two or more plans together in the same sql server database which i need to scrub and then update that particular plan already exists or inserts if they dont...
this is my sproc...
ALTER PROCEDURE [dbo].[usp_Import_Plan]
@ClientId int,
@UserId int = NULL,
@HistoryId int,
@ShowStatus bit = 0-- Indicates whether status messages should be returned during the import.
AS
SET NOCOUNT ON
DECLARE
@Count int,
@Sproc varchar(50),
@Status varchar(200),
@TotalCount int
SET @Sproc = OBJECT_NAME(@@ProcId)
SET @Status = 'Updating plan information in Plan table.'
UPDATE
Statements..Plan
SET
PlanName = PlanName1,
Description = PlanName2
FROM
Statements..Plan cp
JOIN (
SELECT DISTINCT
PlanId,
PlanName1,
PlanName2
FROM
Census
) c
ON cp.CPlanId = c.PlanId
WHERE
cp.ClientId = @ClientId
AND
(
IsNull(cp.PlanName,'') <> IsNull(c.PlanName1,'')
OR
IsNull(cp.Description,'') <> IsNull(c.PlanName2,'')
)
SET @Count = @@ROWCOUNT
IF @Count > 0
BEGIN
SET @Status = 'Updated ' + Cast(@Count AS varchar(10)) + ' record(s) in ClientPlan.'
END
ELSE
BEGIN
SET @Status = 'No records were updated in Plan.'
END
SET @Status = 'Adding plan information to Plan table.'
INSERT INTO Statements..Plan (
ClientId,
ClientPlanId,
UserId,
PlanName,
Description
)
SELECT DISTINCT
@ClientId,
CPlanId,
@UserId,
PlanName1,
PlanName2
FROM
Census
WHERE
PlanId NOT IN (
SELECT DISTINCT
CPlanId
FROM
Statements..Plan
WHERE
ClientId = @ClientId
AND
ClientPlanId IS NOT NULL
)
SET @Count = @@ROWCOUNT
IF @Count > 0
BEGIN
SET @Status = 'Added ' + Cast(@Count AS varchar(10)) + ' record(s) to Plan.'
END
ELSE
BEGIN
SET @Status = 'No information was added Plan.'
END
SET NOCOUNT OFF
So how do i do multiple inserts and updates using this stored procedure...
Regards
Karen
View 5 Replies
View Related
May 9, 2006
Hi all,
what is tuple / tuples.
plz discuss in detail.
thanx
Sajjad
View 5 Replies
View Related
Apr 4, 2007
Below is an error that I run into often. Can someone tell me what is causing this and how to resolve it?
Executing the query ...
The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples.
Execution complete
Here is the MDX that caused the error:
With
Member [Measures].[Total Count] as
'[Measures].[Crash Count]'
Member [Measures].[Total Fatal] as
'[Measures].[Fatal Crashes]'
Member [Measures].[Total Injury] as
'[Measures].[Injury Crashes]'
Member [Measures].[Total A Injury] as
'[Measures].[A Injury Crashes]'
Member [Measures].[Total B Injury] as
'[Measures].[B Injury Crashes]'
Member [Measures].[Total C Injury] as
'[Measures].[C Injury Crashes]'
Member [Measures].[Total 0 Property Damage] as
'[Measures].[0 Property Damage Crashes]'
SELECT
NON EMPTY { [Measures].[Total Count],
[Measures].[Total Fatal],
[Measures].[Total Injury],
[Measures].[Total A Injury],
[Measures].[Total B Injury],
[Measures].[Total C Injury],
[Measures].[Total 0 Property Damage],
[Measures].[Vehicle Count],
[Measures].[Person Count],
[Measures].[Fatalities],
[Measures].[0 Injuries],
[Measures].[A Injuries],
[Measures].[B Injuries],
[Measures].[C Injuries],
[Measures].[Injuries] }
ON COLUMNS,
NON EMPTY {[Crash].[Case Nbr].[Case Nbr] *
[Date].[Calendar Date].[Date] *
[Crash].[Weather].[Weather] *
[Crash].[Road Defects].[Road Defects] *
[Crash].[Collision Type].[Collision Type] *
[Crash].[Light].[Light] }
DIMENSION PROPERTIES MEMBER_CAPTION ON ROWS FROM
(select strtoset('{[Crash].[County].&[Morgan] }')
on columns From
(SELECT STRTOMEMBER('[Crash].[TS Crash Mile Station].[5.28]') :
STRTOMEMBER('[Crash].[TS Crash Mile Station].[5.77]')
on columns From
(select {descendants([Crash].[Case Nbr].Currentmember)}
on Columns from
[SDM_Reports] ))) where ([Reportability].[Is Reportable].&[
View 4 Replies
View Related
Jun 19, 2008
Hi Friends,I have 3 labels Steet,City,Pincode and 3 textboxes related to the labels and one button as nae 'Address'I gave the data for Street:abc,City:xyz,Pincode:123 and have to insert into the table.I created one table in the database with table name Adreess and column address varchar(100)but after giving the values in the textboxes and clicked on the button its throwing the exception i.e System.Data.SqlClient.SqlException: The name "abcxyz123" is not permitted in
this context. Valid expressions are constants, constant expressions, and (in
some contexts) variables. Column names are not permitted.I wrote the code like following protected void Button1_Click(object sender, EventArgs e) { string street = txtStreetNo.Text; string city = txtCity.Text; string pincode = txtPincode.Text; string com = street + city+pincode; conn.Open(); SqlDataAdapter daInsert = new SqlDataAdapter("insert into Address values(" + com.ToString() + ")", conn); daInsert.SelectCommand.ExecuteNonQuery();--->here its giving the exception conn.Close(); Response.Write("the values are inserted"); }Please any one tell me am I did the code write or not if its not please give any suggetionsthanksGeeta
View 3 Replies
View Related
Apr 8, 2008
hello
i want to ask if the insertion of a record into a partion is slower than insertion it into a non partitioned table or not?
cuz sql has to decide to wich partion the record has to insert according to the partitioning key and is this decesion process is making insertion slower ?
View 2 Replies
View Related
Sep 9, 2013
I want XML data to be inserted int SQL table but could not figure out. #Currency is my table with assocaite columns and @XMLCurrency is a variable which holds XML string. How can I insert this XML data to my table.
Create table #Currency (CurrencyId int ,ISOCode nvarchar(10),ISONumbricCOde int,ISOName nvarchar(50), IsEnabledForMPV int default 0)
Declare @XMLCurrency nvarchar(max)
Set @XMLCurrency='<R><T><A>0</A><B>USD</B><C>840</C><D>US Dollar</D></T></R>'
Value 840 should insert into column ISONumbricCOde .
value USD should be insert into ISOCode column.
value 0 should insert into column CurrencyId.
values US Dollar should insert into column ISOName .
View 2 Replies
View Related
Sep 20, 2007
Hi Experts,
I need to know the best approach to save data in master table and then in detail table.
I know this method but i know it's not a good approach why i will explain
Insertion in Master Table..................................... A
Insertion in Detail Table........................................B
Now if there is any exception occurred while step A then the step B will not take place which is ok but if there is exception while step B then the process A will have completed
i.e the data in master table will be Inserted/Deleted/Updated but there will not be a corresponding action in Detail table which is not good approach.
So please can any one tell me a good approach for this.
View 6 Replies
View Related
May 5, 2008
Hi there
I have a relatively noobish query and I am hoping to get a solution to it.
Heres the query in a nutshell.
I have a 'Type' table which has a 'TypeName' varchar attribute. So when I do a row insert into this Type table, I want a new table created with the value I insert into the 'TypeName' column as the table name.
For example If i insert 'xyz' into the 'Type' table for the 'TypeName' column. I wish for a trigger to fire which will create a table 'xyz' with some set attributes. I am really new to SQL Server and my preliminary googling left me disheartened with the results. So here I am.
I hope I was clear in the way I expressed my doubt and also that the people here might be able to help me out in this quest.
View 2 Replies
View Related
Oct 11, 2007
I want to insert data into Header and Details table simultaneously using SQLBulkCopy. Header table contains an Identity columns and Details table contains Foreign Key to this identity column in Header Table.I want to use DataTable as datasource in SQLBulkCopy.Can any body help on this
thanks
View 2 Replies
View Related
Oct 1, 2007
This is my code through which I insert the data into herm_Gen_Liab_Pre table.set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER proc [dbo].[sample]
--@policyno varchar(9),-- FOR MOLD COVERAGE
--@formno varchar(6) -- FOR MOLD COVERAGE
as
TRUNCATE TABLE herm_Gen_Liab_Pre
SET ANSI_WARNINGS OFF
SET ARITHABORT OFF
DECLARE @genliabpre TABLE
( accmnth varchar(2),
accyear varchar (4),
treffmnth varchar (2),
treffyr varchar (4),
trexmnth varchar (2),
trexyr varchar (4),
statecode varchar (2),
typeofpolicy varchar(2),
exposure varchar(7),
annualstatementlineofbusinesscode varchar(3),
PremiumRecordId varchar (14),
Sublinecode varchar (3),
classcode varchar (5),
incemnth varchar (2),
inceyr varchar (4),
territorycode varchar(3)
--policyno varchar(9),-- for mold coverage
--formno varchar(6), -- for mold coverage
--moldcoverage varchar(1) -- mold coverage value
);
insert into @genliabpre (accmnth,accyear,treffmnth,treffyr,trexmnth,trexyr,
statecode,typeofpolicy,exposure,annualstatementlineofbusinesscode,PremiumRecordId,
Sublinecode,classcode,incemnth,inceyr,territorycode)
select datepart(m,p.EntryDate),
datepart(yy,p.EntryDate),
datepart(m,p.PremiumEffectiveDate),
datepart(yy,p.PremiumEffectiveDate),
datepart(m,p.PolicyExpirationDate),
datepart(yy,p.PolicyExpirationDate),
p.statecode,p.policytypecode,p.ExposureLimitAmt,s.lineofbusinesscode,
s.invoiceno,s.sublinecode,s.ClassCode,
datepart(m,p.PolicyOriginalEffectiveDate),
datepart(yy,p.PolicyOriginalEffectiveDate),s.TerritoryCode
from hermitage.dbo.premiumdirect as p join hermitage.dbo.premiumstatdirect as s
on p.invoiceno = s.invoiceno
where
s.lineofbusinesscode in ('052','152','170','171','175','180')--,'192','194') -- general liability
AND P.STATECODE IN ('NY','NJ','PA','RI','GA')
and p.entrydate between '01/01/2004' and '12/31/2007'
order by p.entrydate
----------------------------INSERT MOLD COVERAGE--------------------------------
/*
SET @policyno = (select cast(pd.policyno as varchar(9))
from HERMITAGE.DBO.premiumdirect pd join HERMITAGE.DBO.policyforms pf
on pd.policyno = pf.policyno
where pd.entrydate between '01/01/2004' and '12/31/2007'
and pf.formno in ('CG2167','CG3131')
and exists
( select policyno from HERMITAGE.DBO.premiumdirect p join
HERMITAGE.DBO.premiumstatdirect ps
on substring(pd.policyno,1,9) = substring(pf.policyno,1,9)
where ps.LineOfBusinessCode in ( '170', '052' , '152' , '171', '175', '180')
and ps.sublinecode in ('334','335','336','337','338','339'))
)
SET @FORMNO = (select PF.FORMNO
from HERMITAGE.DBO.premiumdirect pd join HERMITAGE.DBO.policyforms pf
on pd.policyno = pf.policyno
where pd.entrydate between '01/01/2004' and '12/31/2007'
and pf.formno in ('CG2167','CG3131')
and exists
( select policyno from HERMITAGE.DBO.premiumdirect p join
HERMITAGE.DBO.premiumstatdirect ps
on substring(pd.policyno,1,9) = substring(pf.policyno,1,9)
where ps.LineOfBusinessCode in ( '170', '052' , '152' , '171', '175', '180')
and ps.sublinecode in ('334','335','336','337','338','339'))
)
*/
---------------------------------------------------------------------------------
insert into herm_Gen_Liab_Pre (
AccountingDate,
TransactionEffectiveDate,
TransactionExpirationDate,
StateCode,
typeofpolicy,
exposure,
AnnualStatementLineOfBusinessCode,
PremiumRecordId,
SublineCode,
ClassificationCode,
InceptionDate,
territorycode
)
select accmnth= case accmnth
when '1' then '1'
when '2' then '2'
when '3' then '3'
when '4' then '4'
when '5' then '5'
when '6' then '6'
when '7' then '7'
when '8' then '8'
when '9' then '9'
when '10' then '0'
when '11' then '-'
when '12' then '&' end + + SUBSTRING(accyear,4,1),
treffmnth=case treffmnth
when '1' then '1'
when '2' then '2'
when '3' then '3'
when '4' then '4'
when '5' then '5'
when '6' then '6'
when '7' then '7'
when '8' then '8'
when '9' then '9'
when '10' then '0'
when '11' then '-'
when '12' then '&' end + + substring(treffyr,3,2),
trexmnth = case trexmnth
when '1' then '1'
when '2' then '2'
when '3' then '3'
when '4' then '4'
when '5' then '5'
when '6' then '6'
when '7' then '7'
when '8' then '8'
when '9' then '9'
when '10' then '0'
when '11' then '-'
when '12' then '&' end+ + substring(trexyr,3,3),statecode,
typeofpolicy,exposure,AnnualStatementLineOfBusinessCode,premiumrecordid,Sublinecode,
classcode,incemnth = case incemnth
when '1' then '1'
when '2' then '2'
when '3' then '3'
when '4' then '4'
when '5' then '5'
when '6' then '6'
when '7' then '7'
when '8' then '8'
when '9' then '9'
when '10' then '0'
when '11' then '-'
when '12' then '&' end+ + substring(inceyr,3,2),TerritoryCode
from @genliabpre
exec genliab_state
update herm_Gen_Liab_Pre
set territorycode = '999' where statecode = '31'
update herm_Gen_Liab_Pre
set TransactionTypecode ='1'
----------------------STATE EXCEPTION INDICATOR CODE-----------------------------
update herm_Gen_Liab_Pre
set StateExceptionIndicator = '1' where sublinecode = '325' and classificationcode in ('99935','99936') and statecode = '20'
update herm_Gen_Liab_Pre
set StateExceptionIndicator = '1' where sublinecode = '334'
and classificationcode in ('01412','01418','05113','05114','05118','05123','05124'
,'05125','05213','05223','05224','60010','60011','62003','63010','63011'
,'63012','63013','64500') and statecode = '20'
update herm_Gen_Liab_Pre
set StateExceptionIndicator = '1' where sublinecode in ('345','347') and classificationcode = '80050' and statecode = '20'
select * from herm_Gen_Liab_Pre
The problem is there is a column in this table called riskidCoPaymentPercentageMoldDamageCoverageCode and I have to insert value '1' into that column based on this select query
select cast(pd.policyno as varchar(9)),pf.formno
from premiumdirect pd join policyforms pf on pd.policyno = pf.policyno
where pd.entrydate between '01/01/2004' and '12/31/2007'
and pf.formno in ('CG2167','CG3131')
and exists
( select policyno from premiumdirect p join premiumstatdirect ps
on substring(pd.policyno,1,9) = substring(pf.policyno,1,9)
where ps.LineOfBusinessCode in ( '170', '052' , '152' , '171', '175', '180')
and ps.sublinecode in ('334','335','336','337','338','339'))
order by pd.entrydate
How can i insert implement this. I tried temp variable, was successful partially, so need a better approach to it.
Chintan
View 6 Replies
View Related
Jul 28, 2007
Hi,
I have created a cube with three dimensions and one fact. There is no problem While dragging the fields in the Browser window of the cube but the same fields dragging into the SSRS report i am getting the following message:
"The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples".
Can you please help me out.
Thanks
Dinesh
View 3 Replies
View Related
Feb 1, 2006
how to restrict data insertion upto 50 MB in a table?
View 1 Replies
View Related
Oct 6, 2006
Hi,
This problem is connected with the query i posted yesterday regarding insertion of global variables. I was able to insert the variable in a table to check its value.
This value is mapped to the global variable in a previous Execute SQL Task. But when I use the same global variable to insert in a table, default value 0 is inserted.
My query is does the global variable declared at the package level does not store the value mapped across multiple tasks in control flow?
How can i insert the value stored in a variable in a table from previous SQL Task.
Can anyone suggest some solution,links to try a workaround?
Thanks in advance.
Regards,
Aman
View 4 Replies
View Related
May 8, 2015
I wanted to understand the basic difference between the following two MDX queries which give two different outputs -
1. Set of Tuples -
Query-
SELECT
[Measures].[Internet Order Count] ON 0
FROM
[ADVENTURE WORKS]
WHERE
[code]....
2. Tuples in a Set -
Query-
SELECT
[Measures].[Internet Order Count] ON 0
FROM
[ADVENTURE WORKS]
[code]...
From the output i am getting on the MDX, i understand that the analogy is not correct. But I am not able to understand the difference between the same.
View 2 Replies
View Related
May 25, 2006
HI,
How to create package in SSIS by applying the business Logic like if the record already exist it should be and update else it should be an insert in the destination table. how to achive this funcality in SQL SERVER 2005 (Business Intelligence studion).
Thanks & Regards
Nagaraj.S
View 4 Replies
View Related
Nov 17, 2015
Consider a 4 tables where 1 of them is considered to be as the parent class and the other 3 are sub-classes and they are disjoint so for every recored i insert in the parent class i want to also insert in one of the subclass according to a condition which checks a certain attribute in the recored that is also entered in the parent class .. how could this be done .
View 8 Replies
View Related
May 2, 2008
Hi,
I found out that executing the procedure SP_INDEXOPTION and setting 'AllowRowLocks' to false i can prevent the sql server from locking rows in a table and 'AllowPageLocks' prevents from pages being locked. I need to preform same operation
in case of tables. I need to perform insertion operations concurrently and acquire required locks manually. Is there a way to stop sqlserver from acquiring locks on the table. I need to disable all the locks (row, page and table).
Thank you in advance.
View 9 Replies
View Related
Sep 2, 2005
table = PEOPLE
Name Money Type
----- ----- ----
Steve 400 R
Steve 100 R
Paul 500 R
Paul 100 R
Matt 500 R
Matt 200 R
Matt 0 T
Steve 0 T
Paul 0 T
I'm trying to add-up all of the Money values for each Name and store them into their names, but under Type 'T'.
after the update command it should look like this
Name Money Type
----- ----- ----
Steve 400 R
Steve 100 R
Paul 500 R
Paul 100 R
Matt 500 R
Matt 200 R
Matt 700 T
Steve 500 T
Paul 600 T
View 1 Replies
View Related
Jan 22, 2008
I have a backup application that uses SQL as the backend (both 2000 and 2005) The backup application performs a specific function that enters data into the Database but does not have any reporting. I am looking for a way to query the DB directly to see if there is any info I can grab. But the problem is I don't know where its stored. So my questions) are:
Is there anyway to tell what tables get updated by a certain process. For example if I run this one action how could I then tell what tables were effected or even what data was changed. I tried looking for a logging function that would list this but did not find it. I also tried looking for some type of real time monitor. I even tried looking for a way to search for records / tables that had been recently updated.
I am new to SQL so not sure I am using the correct terms but any help would be appreciated. Also this is SQL2000 and a test server
Thanks in advance for your time
View 1 Replies
View Related
Jul 20, 2005
I'm working on a project that is being built piece by piece. The first partis in place. I will occasionally need to either change thing within a table(only adding fields) or add stored procedures etc.What is the best way of making these changes to the production databasewithout interfering with the existing data? The users are remote and I won'tnecessarily have direct access to the server. I'll have to walk the primaryuser through the process.TIA--Jake
View 1 Replies
View Related
Oct 31, 2007
I need to update information for a user and if the user is classified
as a primary (@blnPrimary) then I need to update information for all
users within his agency (AgencyUniqueId). The issue is that the second
UPDATE to "cdds_User_Profile" always returns a rowcount of 0 (should be
1) even though the values for "@Original_AgencyUniqueId" and
"@Original_UserId" are correct. This is just a snippet of the whole
procedure. I'm trying to implement similar logic in other parts of the
procedure and I'm observing the same behavior there as well. Any help
anyone can provide is greatly appreciated. </p><pre>/*** Update User Profile ***/UPDATE [cdds_User_Profile] SET [FirstName] = @FirstName, [LastName] = @LastName, [Title] = @Title, [Phone] = @Phone, [AcctType] = @AcctType, [AcctStatus] = @AcctStatus, [LastUpdatedDate] = GETDATE() WHERE ([FirstName] = @Original_FirstName AND [LastName] = @Original_LastName AND [Title]=@Original_Title AND [Phone]=@Original_Phone AND [AcctType]=@Original_AcctType AND [AcctStatus]= @Original_AcctStatus AND [AgencyUniqueId] = @Original_AgencyUniqueIdAND [UserId] = @Original_UserId);IF @@ROWCOUNT = 0BEGINSET @err_message = 'Data has been edited by another user since you began viewing this information.'RAISERROR (@err_message,11, 1)ROLLBACK TRANSACTIONRETURNEND IF @@ERROR <> 0 BEGINROLLBACK TRANSACTIONRETURN ENDIF @blnPrimary = 1 BEGIN IF LOWER(@AcctStatus) <> LOWER(@AgencyAcctStatus)/*** Update Users Acct. Status ***//* update all users in same agency profile */UPDATE [cdds_User_Profile] SET [AcctStatus] = @AcctStatus,[LastUpdatedDate] = GETDATE() WHERE ([AgencyUniqueId] = @Original_AgencyUniqueIdAND [UserId] = @Original_UserId); IF @@ROWCOUNT = 0BEGINSET @err_message = 'Data for this agency has been edited by another user since you began viewing this information.'RAISERROR (@err_message,11, 1)ROLLBACK TRANSACTIONRETURNENDIF @@ERROR <> 0 BEGINROLLBACK TRANSACTIONRETURN ENDEND</pre><pre>
View 6 Replies
View Related
Sep 5, 2000
Hi,
I am trying to do selective updates for rows where a column matches a column in another table. I want to do something like this, only 'this' does not work, and nothing else I could think of (I tried joins also) worked. What am I missing? I hope this explanation makes sense.
UPDATE queryresultsmodel SET queryresultsmodel.tableforcedoutdate = getdate()
Where Exists (Select tablename from queryresultsmodel q inner join orphanul o on q.tablename = o.name)
Thanks for any help,
Judith
View 1 Replies
View Related
Jul 27, 1998
Hi,
Has anyone had any problems on one row updates on a table where you have defined horizontal and vertical partitioning of the data to be replicated?
When I execute an update clause that modifies just one row the log reader misses the modification and it does not get replicated to the other databases.
If I do the same update clause but on several rows then all the modifications are read by the log reader and the replication task goes ok.
What might be wrong?
-janne
View 1 Replies
View Related
Nov 1, 2006
Hello!
I have 2 database (DB1 and DB2) in 1 server. I want to reflect new changes made in DB1.tbl_pm_project to DB2.tbl_pm_project. Any idea on how to do it.
Thank you
JJ-hon
View 3 Replies
View Related
Feb 11, 2008
Hi
I'm using VS'08 and develop in VB.
I'm using SQL CE 3.5 as a local cache for SQL'05 tables.
The table that's being updated uses an interger autonumber for the PK.
When the program starts up and inserts records into the table, it works, as long as no on else is insering recoreds into the same table.
Once a duplicate PK is created by another WS, the records no longer update the SQL'05 table.
If the blocked program is restarted, it'll insert records with a PK that's past the one found at the initial sync. until blocked again.
PK ---- ProgID ----- MSG
1
0
4
B
hello
2/6/2008 9:33:55 PM
2/6/2008 9:33:55 PM
2
0
4
B
hello
2/11/2008 7:54:38 PM
2/11/2008 7:54:38 PM
3
1
1
B
hello
2/11/2008 8:32:41 PM
2/11/2008 8:32:41 PM
4
0
4
T
just something
2/11/2008 8:34:18 PM
2/11/2008 8:34:18 PM
5
1
1
B
one
2/11/2008 9:13:41 PM
2/11/2008 9:13:41 PM
6
1
1
B
two
2/11/2008 9:14:06 PM
2/11/2008 9:14:06 PM
7
1
1
B
three
2/11/2008 9:14:35 PM
2/11/2008 9:14:35 PM
8
1
1
B
four
2/11/2008 9:15:04 PM
2/11/2008 9:15:04 PM
9
1
1
B
five
2/11/2008 9:15:59 PM
2/11/2008 9:15:59 PM
10
0
4
B
cp 1
2/11/2008 9:17:44 PM
2/11/2008 9:17:44 PM
11
0
4
B
cp 2
2/11/2008 9:18:13 PM
2/11/2008 9:18:13 PM
12
1
1
B
eight
2/11/2008 9:21:31 PM
2/11/2008 9:21:31 PM
13
0
4
B
cp 3
2/11/2008 9:21:52 PM
2/11/2008 9:21:52 PM
NULL
NULL
NULL
NULL
NULL
NULL
NULL
David L.
View 8 Replies
View Related
Feb 5, 2008
Hi. We're using SQL Server 2005 Express Edition for maintaining a relational DB for our soon-to-be released .NET app. The problem is that we expect that the definitions of the tables in the DB to occasionally change over time as we make updates to the software. Thus, during the installation of a software upgrade, we expect to run an SQL script that grabs the data from a table in its "old" format, re-structures the table, and then deposits the data back in the updated table. This seems to require some sort of version stamp on the table definition.
My main question is: What is the conventional way for handling versioning of table definitions?
Another question is: Is there a preferred procedure for handling the updating of the data during the installation of a software update?
Thanks.
Dave
View 3 Replies
View Related
Nov 6, 2007
Simple question:
I have two servers S1 and S2. Inmediately after new data on S1 is available I want to perform some actions on S2.
I can use a trigger on S1, but if S2 is down the transaction on S1 will be lost. I could use database replication but I only need one single table in S1 to report changes to S2
Is there any other approach I could use?
Thanks.
View 1 Replies
View Related
Apr 21, 2004
Hey, I have couple of triggers to one of the tables. It is failing if I update multiple records at the same time from the stored procedure.
UPDATE
table1
SET
col1 = 0
WHERE col2 between 10 and 20
Error I am getting is :
Server: Msg 512, Level 16, State 1, Procedure t_thickupdate, Line 12
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
What is the best possible way to make it work? Thank you.
View 7 Replies
View Related
Nov 5, 2007
I am looking for pros and cons for the following scenarios:
When a table contains a unique key constraint is it viable to always do an insert and immediately check the @@ERROR value and if @@ERROR states a duplicate key exception then perform an update statement?
Another possible solution would be to always check if the key exists and then do the insert / update based upon that result. This method will always require two steps.
View 4 Replies
View Related
Dec 28, 2007
I was able to catch one update but not multiple updates or batch updates done to the table. I know the updated records are residing in inserted and deleted tables. Without using cursors, how can i read and compare all the rows in these two tables?
Following is the table structure:
Customer_Master(custmastercode, customer_company_name,updated_by)
Following is the trigger:
ALTER TRIGGER [TR_UPDATE_CUST]
ON [dbo].[CUSTOMER_MASTER]
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS (SELECT * FROM inserted)
BEGIN
declare @custcode int
Declare @message varchar(5000)
Declare @custommessage varchar(2000)
Declare @CUSTMASTERCODE int
Declare @CUSTOMER_COMPANY_NAME varchar(50)
Set @message = 'Changes in customer account number ' + Cast ((@custcode) as varchar(10)) + ': '
select @custcode = [CUSTMASTERCODE],@UPDATED_BY = [UPDATED_BY] from inserted
Set @message = 'Changes in customer account number ' + Cast ((@custcode) as varchar(10)) + ': '
IF(update([CUSTOMER_COMPANY_NAME]))
Begin
select @UCUSTOMER_COMPANY_NAME = [CUSTOMER_COMPANY_NAME] from deleted
select @CUSTOMER_COMPANY_NAME = [CUSTOMER_COMPANY_NAME] from inserted
Set @custommessage = 'Customer company name changed from ' + @UCUSTOMER_COMPANY_NAME + ' to ' + @CUSTOMER_COMPANY_NAME + '.'
Set @message = @message + @custommessage
End
Set @message = @message + ' Updated by ' + @UPDATED_BY + ' at ' + CAST(getdate() AS VARCHAR(20))+ '.'
INSERT INTO [CHANGE_HISTORY]
([CUSTMASTERCODE]
,[CHANGE_DETAILS])
VALUES (@custcode, @message)
END
END
View 7 Replies
View Related
Mar 5, 2014
Facing deadlock issues in my ETL job .
The driver table , which keeps track of what datamarts ran and for what date range gets updated frequently during the etl run . There can be as many as 250 updates issued on this table in a single second.
Now this table is a heap , and there are no indexes on it .
During these updates , we encounter deadlocks causing the ETL job to fail .
Will adding an index faciltate?
View 4 Replies
View Related
Jun 27, 2014
I am basically trying to update a table which reflects account transactions. Accounts get paid in full but occasionally balance payments can be reversed and I want to update the table to show this - I need to show which period the account was previously paid in full.I've created a simplified version of the scenario and below are a couple of examples of things I've tried that do not work. I understand why they do not work but I'm struggling to figure out how to update the 'PeriodPrevPaidInFull' field.
create table Trans
(
AccNo int,
Transaction_Period_Index int,
PeriodOpeningBalance money,
DebtBalance money,
PeriodPaidInFull int NULL,
PeriodPrevPaidInFull int NULL,
[code]...
View 9 Replies
View Related