|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: |
DECLARE @startp int, @startr int,@alldatacount int, @tableA int,@tableAcount int, @tableB int,@tableBcount int SELECT @startp=MAX(QID) FROM serverA.databaseA.dbo.tableA SELECT @startr=MAX(QID) FROM dbo.tableA if(@startp > @startr) BEGIN DECLARE @alldata TABLE (pQID int not null,TimeSS datetime not null,UserID varchar(16) not null, AcctID varchar(16) not null,Symbol varchar(25) not null,Desk varchar(20) not null,Strategy varchar(20) not null, CurrentNet bigint not null, TodayBought bigint not null,TodaySold bigint not null, rQID int not null,rType varchar(10) not null,rAmount decimal(18,4) not null) INSERT @alldata ( pQID,TimeSS,UserID,AcctID,Symbol,Desk,Strategy,CurrentNet,TodayBought,TodaySold,rQID,rType,rAmount) SELECT p1.QID,p1.TimeSS,p1.UserID,p1.AcctID,p1.Symbol,p1.Desk,p1.Strategy,p1.CurrentNet,p1.TodayBought,p1.TodaySold, p2.QID,p2.Type,p2.Amount FROM serverA.databaseA.dbo.tableA p1 INNER JOIN serverA.databaseA.dbo.tableB p2 ON p1.QID = p2.QID AND p1.TimeSS >= CONVERT(CHAR(8),GETDATE(),112) WHERE NOT EXISTS(SELECT 1 FROM dbo.tableA r1 WHERE p1.QID = r1.QID) SET @alldatacount = @@ROWCOUNT SELECT CONVERT(VARCHAR,@alldatacount) + ' Records copied to @alldata.' IF(@alldatacount > 0) BEGIN SET IDENTITY_INSERT tableA ON INSERT dbo.tableA(QID,TimeSS,UserID,AcctID,Symbol,Desk,Strategy,CurrentNet,TodayBought,TodaySold) SELECT pQID,TimeSS,UserID,AcctID,Symbol,Desk,Strategy,CurrentNet,TodayBought,TodaySold FROM @alldata SET @tableAcount = @@ROWCOUNT SET IDENTITY_INSERT tableA OFF SELECT CONVERT(VARCHAR,@tableAcount) + ' Records copied to dbo.tableA from @alldata.' IF(@tableAcount >0) BEGIN INSERT dbo.tableB(QID,Type,Amount) SELECT rQID,rType,rAmount FROM @alldata q1 INNER JOIN dbo.tableA q2 ON q1.rQID = q2.QID AND q2.TimeSS >=CONVERT(CHAR(8),GETDATE(),112) SET @tableBcount = @@ROWCOUNT SELECT CONVERT(VARCHAR,@tableBcount) + ' Records copied to dbo.tableB from @alldata.' END IF(@@ERROR <> 0) BEGIN EXEC msdb..sp_send_dbmail @recipients= 'me', @subject='blah blah', @body='The synch job failed, please review.' END END END |
Advertisement
| Hall of Fame |