Help Me To Simplify This Process
Nov 6, 2007
SELECT WRREGN,WRCONO,WRDESC,WRWH01 as "WRWHSE", 1 as "WRORDER", WRDTMT
FROM PPTREASUSA.WHREGN
WHERE RTRIM(WRWH01)<>''
UNION
SELECT WRREGN,WRCONO,WRDESC,WRWH02 as "WRWHSE", 2 as "WRORDER", WRDTMT
FROM PPTREASUSA.WHREGN
WHERE RTRIM(WRWH02)<>''
.
.
.
.
.
UNION
SELECT WRREGN,WRCONO,WRDESC,WRW100 as "WRWHSE", 100 as "WRORDER", WRDTMT
FROM PPTREASUSA.WHREGN
WHERE RTRIM(WRW100)<>''
I have 100 queries pretty similar. Can I write one query for all instead?. How could I simplify this process? Using a cursor?
http://www.sqlserverstudy.com
View 12 Replies
ADVERTISEMENT
May 27, 2008
Hi all, anyway to simplify this?
SELECT DISTINCT Code_Name, Code_Desc, Code_Reaction_Guide FROM dbo.tbl_ref_OutgoingQA_Control_Limits l, dbo.tbl_ref_SPC_Rules_Code r, dbo.tbl_ref_OutgoingQA_Chart_Type c
WHERE r.Code_Area = 'A' AND r.Test_Type = 'B' AND r.Code_Mode = 'C'
AND r.Code_Name = '1' AND l.Chart_Type_ID = c.Chart_Type_ID AND l.Test_Type = c.Test_Type AND l.Rule1 = 1
UNION
SELECT DISTINCT Code_Name, Code_Desc, Code_Reaction_Guide FROM dbo.tbl_ref_OutgoingQA_Control_Limits l, dbo.tbl_ref_SPC_Rules_Code r, dbo.tbl_ref_OutgoingQA_Chart_Type c
WHERE r.Code_Area = 'A' AND r.Test_Type = 'B' AND r.Code_Mode = 'C'
AND r.Code_Name = '2' AND l.Chart_Type_ID = c.Chart_Type_ID AND l.Test_Type = c.Test_Type AND l.Rule2 = 1
UNION
SELECT DISTINCT Code_Name, Code_Desc, Code_Reaction_Guide FROM dbo.tbl_ref_OutgoingQA_Control_Limits l, dbo.tbl_ref_SPC_Rules_Code r, dbo.tbl_ref_OutgoingQA_Chart_Type c
WHERE r.Code_Area = 'A' AND r.Test_Type = 'B' AND r.Code_Mode = 'C'
AND r.Code_Name = '3' AND l.Chart_Type_ID = c.Chart_Type_ID AND l.Test_Type = c.Test_Type AND l.Rule3 = 1
UNION
SELECT DISTINCT Code_Name, Code_Desc, Code_Reaction_Guide FROM dbo.tbl_ref_OutgoingQA_Control_Limits l, dbo.tbl_ref_SPC_Rules_Code r, dbo.tbl_ref_OutgoingQA_Chart_Type c
WHERE r.Code_Area = 'A' AND r.Test_Type = 'B' AND r.Code_Mode = 'C'
AND r.Code_Name = '4' AND l.Chart_Type_ID = c.Chart_Type_ID AND l.Test_Type = c.Test_Type AND l.Rule4 = 1
UNION
SELECT DISTINCT Code_Name, Code_Desc, Code_Reaction_Guide FROM dbo.tbl_ref_OutgoingQA_Control_Limits l, dbo.tbl_ref_SPC_Rules_Code r, dbo.tbl_ref_OutgoingQA_Chart_Type c
WHERE r.Code_Area = 'A' AND r.Test_Type = 'B' AND r.Code_Mode = 'C'
AND r.Code_Name = '5A' AND l.Chart_Type_ID = c.Chart_Type_ID AND l.Test_Type = c.Test_Type AND l.Rule5A = 1
UNION
SELECT DISTINCT Code_Name, Code_Desc, Code_Reaction_Guide FROM dbo.tbl_ref_OutgoingQA_Control_Limits l, dbo.tbl_ref_SPC_Rules_Code r, dbo.tbl_ref_OutgoingQA_Chart_Type c
WHERE r.Code_Area = 'A' AND r.Test_Type = 'B' AND r.Code_Mode = 'C'
AND r.Code_Name = '5B' AND l.Chart_Type_ID = c.Chart_Type_ID AND l.Test_Type = c.Test_Type AND l.Rule5B = 1
View 1 Replies
View Related
Oct 11, 2007
I have the following where clause below which works fine. However, I have not been advised that the client also requires the range of codes: 1400-2089 and 2100-2299 which do not lend themselves readily to the IN statement.
I realize I could add yet another OR statement, however, I would prefer to simplify this query without it getting larger and larger with future request. Can someone suggest a better query?
Where
(DischDate between '2006-11-01' and '2007-09-30' And
PrinDxCode
IN ('042','140','2089','2031','2051','2100','2299','2300',
'2349','2350','2389','2390','2399','2732','2733','2849',
'2850','2883','2898','V073','V078','V100','V109','V580',
'V581','V661','V662','V671','V672','V711','V760','V769'))
Or (DischDate between '2006-11-01' and '2007-09-30' And
SecDx1Code
IN ('042','140','2089','2031','2051','2100','2299','2300',
'2349','2350','2389','2390','2399','2732','2733','2849',
'2850','2883','2898','V073','V078','V100','V109','V580',
'V581','V661','V662','V671','V672','V711','V760','V769'))
View 15 Replies
View Related
Mar 2, 2006
I’ve got a table called tblApplicant_Details with the following fields - Applicant_ID, Application_ID, Net_Income, Loans.
In this table I’ve got a list of people and their income details (Net_Income) and expenses (loans). In some cases there will be 2 applicants with the same application_ID.
What I need to do is select one applicant (Applicant_ID) per application (Application_ID). In the case of 2 applicants for an application, I need to select the person with the highest income (net_income - loans), if both of the applicants have the same income I want the one with the lowest Applicant_ID and if only one person applies then that person.
Below is the code I’ve been using. I’ve noticed that its not always selecting an applicant for each application. I know it’s also very long for what I am trying to do but I was hoping someone would be able to tell me how I can fix it and tidy it up a bit.
SELECT Application_ID, MIN(Applicant_ID) AS Applicant_ID
FROM (SELECT DERIVEDTBL.Application_ID, dbo.tblAPPLICANT_DETAILS.Applicant_ID
FROM (SELECT MAX(APPLICANT.Net_Income - APPLICANT.Loans) AS Income, APPLICATION.Application_ID
FROM dbo.tblAPPLICANT_DETAILS APPLICANT INNER JOIN
dbo.tblAPPLICATION_DETAILS APPLICATION ON APPLICANT.Application_ID = APPLICATION.Application_ID
GROUP BY APPLICATION.Application_ID) DERIVEDTBL INNER JOIN
dbo.tblAPPLICANT_DETAILS ON DERIVEDTBL.Application_ID = dbo.tblAPPLICANT_DETAILS.Application_ID AND
DERIVEDTBL.Income = dbo.tblAPPLICANT_DETAILS.Net_Income - Loans) DERIVEDTBL
GROUP BY Application_ID
Thanks
View 3 Replies
View Related
Jul 23, 2005
Hello group!I am having a problem with simplying my query...I would like to get customers' balance info based on how many monthssince they opened their accounts. The tricky part here is accountsstarting with '28' are treated differently than other accounts, theyare given 3 months grace period. In other words, for all otheraccounts, their month0 balance is the balance of their open_month, andmonth1 balance is the balance after the account is opened 1 month, andso on. But accounts starting with '28' month0 balance would be thebalance after the account is opened 3 months, and month1 balance wouldbe the balance after the account is opened 4 months, and so on.My query below works, but since some customers are more than 10 yearsold (more than 120 months), my query is endless! Does anyone know abetter way to do the same job? Many thanks!create table a(person_id int,account int,open_date datetime)insert into a values(1,200001,'11/15/2004')insert into a values(2,280001,'8/20/2004')create table b(account int,balance_date datetime,balance money)insert into b values(200001,'11/30/2004',700)insert into b values(200001,'12/31/2004',800)insert into b values(200001,'1/31/2005',900)insert into b values(200001,'2/28/2005',1000)insert into b values(280001,'8/30/2004',7000)insert into b values(280001,'9/30/2004',8000)insert into b values(280001,'10/31/2004',9000)insert into b values(280001,'11/30/2004',10000)insert into b values(280001,'12/31/2004',15000)insert into b values(280001,'1/31/2005',20000)insert into b values(280001,'2/28/2005',30000)--Ideal output--person_idacc_nomonth0_balancemonth1_balancemonth2_balancemonth3_balance1200000170080090010002280000110000150002000030000select a.person_id,a.account,month0_balance=casewhen a.account like '2%' and a.account not like '28%'thensum(case datediff(mm, a.open_date, balance_date) when 0then b.balance else 0 end)else sum(case datediff(mm, a.open_date, balance_date)when 3 then b.balance else 0 end)end,month1_balance =casewhen a.account like '2%' and a.account not like '28%'thensum(case datediff(mm, a.open_date, balance_date) when 1then b.balance else 0 end)else sum(case datediff(mm, a.open_date, balance_date)when 4 then b.balance else 0 end)endfrom a as ajoin b as bon a.account=b.accountgroup by a.person_id, a.account
View 3 Replies
View Related
Jan 20, 2005
Dear Reader(s),
Is there anyway to write the following stored procedure without the loop so that it goes much faster? :confused:
----------------------------------------------------------------------------
use MJ_ReportBase
go
if exists(select 1 from sysobjects where type='P' and name='sp_Periode')
begin
drop procedure sp_Periode
end
go
create procedure sp_Periode
@start int
, @stop int
as
declare @x int
set @x = 0
set @x=@start
delete from tbl_periode
while (@x>=@stop)
begin
-- ---
-- ---
-- Create table tbl_inout
if exists(select 1 from sysobjects where type='U' and name='tbl_inout')
begin
drop table tbl_inout
end
select datetimestamp,accname,badgeid,personname,inoutreg into tbl_inout from WinXS..x18 where convert(varchar,datetimestamp,120)+' '+ltrim(str(id))+' '+ltrim(str(badgeid)) in
(select convert(varchar,max(datetimestamp),120)+' '+ltrim(str(max(id)))+' '+ltrim(str(badgeid)) as datetimestamp from WinXS..x18 where (accname='Kelder -1' or accname='Tnk Entree') and convert(varchar,datetimestamp,105)=convert(varchar ,getdate()-abs(@x),105) group by badgeid)
and badgeid>0
order by personname
-- ---
-- ---
-- Create table tbl_result
if exists(select 1 from sysobjects where type='U' and name='tbl_result')
begin
drop table tbl_result
end
-- ---
-- ---
select
convert(varchar,datetimestamp,105) 'DATUM'
, badgeid 'PAS'
, initials 'VOORNAAM'
, personname 'NAAM'
, convert(varchar,min(datetimestamp),108) 'MIN'
, convert(varchar,max(datetimestamp),108) 'MAX'
into
tbl_result
from
WinXS..x18
where
convert(varchar,datetimestamp,105)=convert(varchar ,getdate()-abs(@x),105)
and
accname in ('Kelder -1','Tnk Entree')
and badgeid>0
group by
convert(varchar,WinXS..x18.datetimestamp,105)
, badgeid
, initials
, personname
order by
initials
, personname asc
, convert(varchar,datetimestamp,105) asc
-- ---
-- ---
-- Rapportage tabel
insert into
tbl_periode
select
tbl_result.datum as DATUM
, ltrim(ltrim(rtrim(tbl_result.naam))+' '+ltrim(rtrim(isnull(tbl_result.voornaam,' ')))) as NAAM
, tbl_result.min as MIN
, tbl_result.max as MAX
, case tbl_inout.inoutreg when 1 then 'in' when 2 then 'out' else 'err' end as [IN/OUT]
, substring('00000',1,5-len(tbl_result.pas))+ltrim(str(tbl_result.pas)) as PAS
from
tbl_inout,tbl_result
where
tbl_result.datum+' '+tbl_result.max+' '+ltrim(str(tbl_result.pas))
= convert(varchar,tbl_inout.datetimestamp,105)+' '+convert(varchar,tbl_inout.datetimestamp,108)+' '+ltrim(str(badgeid))
order by
tbl_result.naam asc
-- ---
-- ---
--
set @x=@x-1
end
go
print 'Klaar!'
--------------------------------------------------------------------------
What it does is determining the minimum entry time and the maximum exiting time per day of people going true the main entrance of a building.
Many thanks in advance.
:)
View 3 Replies
View Related
Oct 9, 2007
I received the following error today while migrating some code from SQL 2000 standard to SQL 2005 standard:
The query processor ran out of stack space during query optimization. Please simplify the query.
From what I gather, this error is usually an indication that one of the SQL Server 2005 maximum capacity specifications has been exceeded. However, I'm not sure which one. The only one that seems suspect is the number of nested subqueries (32), however I believe the numerous subqueries in my query would be classified as correlated rather than nested.
An example of my code is below. It is necessarily messy, as the output needs to be denormalized somewhat. Note that this runs just fine on SQL 2000, and it retrieves the 1500 or so rows of data in about 30 seconds. Thanks in advance for any ideas as to what may be causing this error. (Sorry for not using code-block, but all the html tags it threw in were exceeding the 50,000 character limit for the message)
BEGIN
SELECT
(SELECT Agent FROM Agent a WHERE a.Card_Number = c.Card_Number AND Agent_Number = 1) AS A5,
(SELECT Agent FROM Agent a WHERE a.Card_Number = c.Card_Number AND Agent_Number = 2) AS A6,
(SELECT Agent FROM Agent a WHERE a.Card_Number = c.Card_Number AND Agent_Number = 3) AS A7,
(SELECT Agent FROM Agent a WHERE a.Card_Number = c.Card_Number AND Agent_Number = 4) AS A8,
dbo.f_formatpseudodate(Accrued_Interest_To) AS AI,
dbo.f_getmiscdescription('AM', c.Card_Number, Amended) AS AM,
Basis_Shareblock_1 AS B1,
Basis_Shareblock_2 AS B2,
Basis_Shareblock_3 AS B3,
Basis_Shareblock_4 AS B4,
Basis AS BS,
dbo.f_getmiscdescription('C1', c.Card_Number, Price_Code_1) AS C1,
dbo.f_getmiscdescription('C2', c.Card_Number, Price_Code_2) AS C2,
dbo.f_getmiscdescription('C3', c.Card_Number, Price_Code_3) AS C3,
dbo.f_getmiscdescription('C4', c.Card_Number, Price_Code_4) AS C4,
dbo.f_getmiscdescription('C5', c.Card_Number, Price_Code_5) AS C5,
dbo.f_getmiscdescription('C6', c.Card_Number, Price_Code_6) AS C6,
CAST(Card_Date AS smalldatetime) AS CD,
c.Card_Number AS CN,
dbo.f_getisocurrencycode(Currency_Code) AS CR,
Card_Status AS CS,
dbo.f_formatpseudodate(Record_Date) AS CT,
Currency_Description AS CU,
(SELECT New_Issue_Description FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 1) AS D1,
(SELECT New_Issue_Description FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 2) AS D2,
(SELECT New_Issue_Description FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 3) AS D3,
(SELECT New_Issue_Description FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 4) AS D4,
(SELECT New_Issue_Description FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 5) AS D5,
(SELECT New_Issue_Description FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 6) AS D6,
dbo.f_formatboolean(Dutch_Auction) AS DA,
dbo.f_formatpseudodate(Dated_Date) AS DD,
dbo.f_getmiscdescription('DI', c.Card_Number, Distribution_In) AS DI,
Dealer_Manager_2 AS DL,
Dealer_Manager_1 AS DM,
dbo.f_getmiscdescription('DV', c.Card_Number, Dividend_In) AS DV,
Basis_Surrender_1 AS E1,
Basis_Receive_1_1 AS E2,
Basis_Amount_1_1 AS E3,
Basis_CUSIP_1_1 AS E4,
Basis_Receive_1_2 AS E5,
Basis_Amount_1_2 AS E6,
Basis_CUSIP_1_2 AS E7,
Basis_Receive_1_3 AS E8,
Basis_Amount_1_3 AS E9,
dbo.f_getmiscdescription('EC', c.Card_Number, Record_Date_Code) AS EC,
Equity_Debt AS ED,
dbo.f_getmiscdescription('EF', c.Card_Number, Effective_Date_Code) AS EF,
dbo.f_getmiscdescription('EX', c.Card_Number, Expiration_Date_Code) AS EX,
dbo.f_getmiscdescription('F1', c.Card_Number, Refer_Code_1) AS F1,
dbo.f_getmiscdescription('F2', c.Card_Number, Refer_Code_2) AS F2,
dbo.f_getmiscdescription('F3', c.Card_Number, Refer_Code_3) AS F3,
dbo.f_formatpseudodate(Effective_Date) AS FD,
File_Activity_Type AS FT,
dbo.f_getmiscdescription('G1', c.Card_Number, Rights_Ratio_1) AS G1,
dbo.f_getmiscdescription('G2', c.Card_Number, Rights_Ratio_2) AS G2,
dbo.f_getmiscdescription('G3', c.Card_Number, Rights_Ratio_3) AS G3,
RTRIM(LTRIM(Original_Card_Number)) AS GC,
dbo.f_getmiscdescription('GD', c.Card_Number, Ex_Rights_Date_Code) AS GD,
dbo.f_getmiscdescription('GT', c.Card_Number, Rights_To) AS GT,
Basis_Amount_2_3 AS H1,
Basis_CUSIP_2_3 AS H2,
Basis_Surrender_3 AS H3,
Basis_Receive_3_1 AS H4,
Basis_Amount_3_1 AS H5,
Basis_CUSIP_3_1 AS H6,
Basis_Receive_3_2 AS H7,
Basis_Amount_3_2 AS H8,
Basis_CUSIP_3_2 AS H9,
Information_Agent_1 AS I1,
Information_Agent_2 AS I2,
Interest_Rate AS [IN],
dbo.f_getmiscdescription('J1', c.Card_Number, Subscription_Ratio_Code_1) AS J1,
dbo.f_getmiscdescription('J2', c.Card_Number, Subscription_Ratio_Code_2) AS J2,
dbo.f_getmiscdescription('J3', c.Card_Number, Subscription_Ratio_Code_3) AS J3,
Basis_CUSIP_4_2 AS K1,
Basis_Receive_4_3 AS K2,
Basis_Amount_4_3 AS K3,
Basis_CUSIP_4_3 AS K4,
Basis_Receive_3_3 AS L1,
Basis_Amount_3_3 AS L2,
Basis_CUSIP_3_3 AS L3,
Basis_Surrender_4 AS L4,
Basis_Receive_4_1 AS L5,
Basis_Amount_4_1 AS L6,
Basis_CUSIP_4_1 AS L7,
Basis_Receive_4_2 AS L8,
Basis_Amount_4_2 AS L9,
dbo.f_formatpseudodate(Withdrawal_After) AS LA,
dbo.f_getmiscdescription('LC', c.Card_Number, Withdrawal_After_Code) AS LC,
dbo.f_getmiscdescription('LG', c.Card_Number, Eligibility) AS LG,
Withdrawal_After_Time AS LT,
dbo.f_getmiscdescription('LZ', c.Card_Number, Withdrawal_After_Zone) AS LZ,
Option_Expiration_Time AS M1,
Rights_Expire_Time AS M3,
Expiration_Date_Time AS M4,
dbo.f_formatpseudodate(Maturity_Date) AS MD,
Maximum_Eligibility AS ME,
dbo.f_validatecardnumber(Refer_Card_1) AS N1,
dbo.f_validatecardnumber(Refer_Card_2) AS N2,
dbo.f_validatecardnumber(Refer_Card_3) AS N3,
dbo.f_getmiscdescription('NT', c.Card_Number, Interest_Rate_Code) AS NT,
DTC_Match_Card_Number AS O3,
Offer_By AS OB,
Odd_Lot AS OD,
dbo.f_getmiscdescription('OV', c.Card_Number, OverSubscription) AS OV,
dbo.f_formatpseudodate(Option_Expiration_Date) AS OX,
(SELECT Agent_Telephone FROM Agent a WHERE a.Card_Number = c.Card_Number AND Agent_Number = 4) AS P1,
Information_Agent_Telephone_1 AS P2,
Information_Agent_Telephone_2 AS P3,
Dealer_Manager_Telephone_1 AS P4,
Dealer_Manager_Telephone_2 AS P5,
CUSIP_Number AS PN,
dbo.f_formatpseudodate(Pro_Ration_Date) AS PO,
dbo.f_getmiscdescription('PY', c.Card_Number, Payable_To) AS PY,
dbo.f_getmiscdescription('PZ', c.Card_Number, Protect_Period) AS PZ,
Price_1 AS R1,
Price_2 AS R2,
Price_3 AS R3,
Price_4 AS R4,
Price_5 AS R5,
Price_6 AS R6,
dbo.f_getmiscdescription('RB', c.Card_Number, Rights_Transferable) AS RB,
Rights_CUSIP AS RC,
Issuer_Description AS RD,
dbo.f_getmiscdescription('RI', c.Card_Number, Pro_Ration_Date_Code) AS RI,
Record_Type AS RT,
dbo.f_formatpseudodate(Rights_Expire_Date) AS RX,
CAST(Subscription_Ratio_1 AS varchar(12)) + Subscription_Ratio_1_Unit AS S1,
CAST(Subscription_Ratio_2 AS varchar(12)) + Subscription_Ratio_2_Unit AS S2,
CAST(Subscription_Ratio_3 AS varchar(12)) + Subscription_Ratio_3_Unit AS S3,
dbo.f_getmiscdescription('SC', c.Card_Number, Source_Name) AS SC,
Service_Type AS SE,
dbo.f_getmiscdescription('ST', c.Card_Number, Subscription_To) AS ST,
(SELECT Redemption_Agent_Telephone FROM Redemption_Agent ra WHERE ra.Card_Number = c.Card_Number AND Redemption_Agent_Number = 1) AS T2,
(SELECT Redemption_Agent_Telephone FROM Redemption_Agent ra WHERE ra.Card_Number = c.Card_Number AND Redemption_Agent_Number = 2) AS T3,
(SELECT Redemption_Agent_Telephone FROM Redemption_Agent ra WHERE ra.Card_Number = c.Card_Number AND Redemption_Agent_Number = 3) AS T4,
(SELECT Redemption_Agent_Telephone FROM Redemption_Agent ra WHERE ra.Card_Number = c.Card_Number AND Redemption_Agent_Number = 4) AS T5,
(SELECT Agent_Telephone FROM Agent a WHERE a.Card_Number = c.Card_Number AND Agent_Number = 1) AS T7,
(SELECT Agent_Telephone FROM Agent a WHERE a.Card_Number = c.Card_Number AND Agent_Number = 2) AS T8,
(SELECT Agent_Telephone FROM Agent a WHERE a.Card_Number = c.Card_Number AND Agent_Number = 3) AS T9,
Tickler_Date AS TK,
dbo.f_getmiscdescription('TP', c.Card_Number, To_Purchase) AS TP,
dbo.f_getmiscdescription('TS', c.Card_Number, Transaction_Status) AS TS,
dbo.f_gettxtext(c.Card_Number) AS TX,
Basis_CUSIP_1_3 AS U1,
Basis_Surrender_2 AS U2,
Basis_Receive_2_1 AS U3,
Basis_Amount_2_1 AS U4,
Basis_CUSIP_2_1 AS U5,
Basis_Receive_2_2 AS U6,
Basis_Amount_2_2 AS U7,
Basis_CUSIP_2_2 AS U8,
Basis_Receive_2_3 AS U9,
RTRIM(Issue_Description) AS UD,
Voluntary_Mandatory AS VM,
(SELECT New_Issue_CUSIP FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 1) AS W1,
(SELECT New_Issue_CUSIP FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 2) AS W2,
(SELECT New_Issue_CUSIP FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 3) AS W3,
(SELECT New_Issue_CUSIP FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 4) AS W4,
(SELECT New_Issue_CUSIP FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 5) AS W5,
(SELECT New_Issue_CUSIP FROM New_Issue ni WHERE ni.Card_Number = c.Card_Number AND New_Issue_Number = 6) AS W6,
dbo.f_formatpseudodate(Withdrawal_Prior_To) AS WD,
Withdrawal_Prior_To_Time AS WH,
dbo.f_getmiscdescription('WO', c.Card_Number, Withdrawal_Prior_To_Code) AS WO,
dbo.f_getmiscdescription('WZ', c.Card_Number, Withdrawal_Prior_To_Zone) AS WZ,
(SELECT Payable_Rate_Amount FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number =3) AS X1,
(SELECT Payable_Rate_CUSIP FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number = 3) AS X2,
dbo.f_formatpseudodate(Expiration_Date) AS XD,
dbo.f_formatpseudodate(Ex_Rights_Date) AS XR,
dbo.f_getmiscdescription('XT', c.Card_Number, Rights_Expire_Code) AS XT,
Payable_Rate_Shareblock AS Y1,
Payable_Rate_Surrender AS Y2,
(SELECT Payable_Rate_Receive FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number =1) AS Y3,
(SELECT Payable_Rate_Amount FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number =1) AS Y4,
(SELECT Payable_Rate_CUSIP FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number =1) AS Y5,
(SELECT Payable_Rate_Receive FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number =2) AS Y6,
(SELECT Payable_Rate_Amount FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number =2) AS Y7,
(SELECT Payable_Rate_CUSIP FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number =2) AS Y8,
(SELECT Payable_Rate_Receive FROM Payable_Rate pr WHERE pr.Card_Number = c.Card_Number AND Payable_Rate_Number =3) AS Y9,
dbo.f_formatpseudodate(Payment_Date) AS YD,
dbo.f_getmiscdescription('YR', c.Card_Number, Payable_Rate) AS YR,
dbo.f_getmiscdescription('Z1', c.Card_Number, Option_Expiration_Zone) AS Z1,
Rights_Expire_Zone AS Z3,
Expiration_Date_Zone AS Z4
FROM COMMON c
INNER JOIN DC_DailyCard dc ON c.Card_Number = dc.Card_Number
WHERE c.Card_Status = 'R' AND c.Card_Date BETWEEN @start_date AND @end_date
END
View 2 Replies
View Related
Nov 14, 2007
Hi,
I was trying to extract data from the source server using OLEDB Source and SQL Server Destination when i encountered this error:
"Transaction (Process ID 135) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.".
What must be done so that even if the table being queried is locked, i wouldn't experience any deadlock?
cherriesh
View 4 Replies
View Related
Dec 3, 2007
Hello all,
I am running into an interesting scenario on my desktop. I'm running developer edition on Windows XP Professional (9.00.3042.00 SP2 Developer Edition). OS is autopatched via corporate policy and I saw some patches go in last week. This machine is also a hand-me-down so I don't have a clean install of the databases on the machine but I am local admin.
So, starting last week after a forced remote reboot (also a policy) I noticed a few of the databases didn't start back up. I chalked it up to the hard shutdown and went along my merry way. Friday however I know I shut my machine down nicely and this morning when I booted up, I was in the same state I was last Wenesday. 7 of the 18 databases on my machine came up with
FCB:pen: Operating system error 32(The process cannot access the file because it is being used by another process.) occurred while creating or opening file 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataTest.mdf'. Diagnose and correct the operating system error, and retry the operation.
and it also logs
FCB:pen failed: Could not open file C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataTest.mdf for file number 1. OS error: 32(The process cannot access the file because it is being used by another process.).
I've caught references to the auto close feature being a possible culprit, no dice as the databases in question are set to False. Recovery mode varies on the databases from Simple to Full. If I cycle the SQL Server service, whatever transient issue it was having with those files is gone.
As much as I'd love to disable the virus scanner, network security would not be amused. The data and log files appear to have the same permissions as unaffected database files. Nothing's set to read only or archive as I've caught on other forums as possible gremlins. I have sufficient disk space and the databases are set for unrestricted growth.
Any thoughts on what I could look at? If it was everything coming up in RECOVERY_PENDING it's make more sense to me than a hit or miss type of thing I'm experiencing now.
View 13 Replies
View Related
Mar 11, 2008
Dear list
Im designing a package that uses Microsofts preplog.exe to prepare web log files to be imported into SQL Server
What Im trying to do is convert this cmd that works into an execute process task
D:SSIS ProcessPrepweblogProcessLoad>preplog ex.log > out.log
the above dos cmd works 100%
However when I use the Execute Process Task I get this error
[Execute Process Task] Error: In Executing "D:SSIS ProcessPrepweblogProcessLoadpreplog.exe" "" at "D:SSIS ProcessPrepweblogProcessLoad", The process exit code was "-1" while the expected was "0".
There are two package varaibles
User::gsPreplogInput = ex.log
User::gsPreplogOutput = out.log
Here are the task properties
RequireFullFileName = True
Executable = D:SSIS ProcessPrepweblogProcessLoadpreplog.exe
Arguments =
WorkingDirectory = D:SSIS ProcessPrepweblogProcessLoad
StandardInputVariable = User::gsPreplogInput
StandardOutputVariable = User::gsPreplogOutput
StandardErrorVariable =
FailTaskIfReturnCodeIsNotSuccessValue = True
SuccessValue = 0
TimeOut = 0
thanks in advance
Dave
View 1 Replies
View Related
Jan 30, 2007
How do I use the execute process task? I am trying to unzip the file using the freeware PZUnzip.exe and I tried to place the entire command in a batch file and specified the working directory as the location of the batch file, but the task fails with the error:
SSIS package "IngramWeeklyPOS.dtsx" starting.
Error: 0xC0029151 at Unzip download file, Execute Process Task: In Executing "C:ETLPOSDataIngramWeeklyUnzip.bat" "" at "C:ETLPOSDataIngramWeekly", The process exit code was "1" while the expected was "0".
Task failed: Unzip download file
SSIS package "IngramWeeklyPOS.dtsx" finished: Success.
Then I tried to specify the exe directly in the Executable property and the agruments as the location of the zip file and the directory to unzip the files in, but this time it fails with the following message:
SSIS package "IngramWeeklyPOS.dtsx" starting.
Error: 0xC002F304 at Unzip download file, Execute Process Task: An error occurred with the following error message: "%1 is not a valid Win32 application".
Task failed: Unzip download file
SSIS package "IngramWeeklyPOS.dtsx" finished: Success.
The command in the batch file when run from the command line works perfectly and unzips the file, so there is absolutely no problem with the command, I believe it is just the set up of the variables on the execute process task editor under Process. Any input on resolving this will be much appreciated.
Thanks,
Monisha
View 1 Replies
View Related
Mar 20, 2008
I am designing a utility which will keep two similar databases in sync. In other words, copying the new data from db1 to db2 and updating the old data from db1 to db2.
For this I am making use of the 'Tablediff' utility which when provided with server name, database, table info will generate .sql file which can be used to keep the target table in sync with the source table.
I am using the Execute Process Task and the process parameters I am providing are:
WorkingDirectory : C:Program Files (x86)Microsoft SQL Server90COM
Executable : C:SQL_bat_FilesSQL5TC_CTIcustomer.bat
The customer.bat file will have the following code:
tablediff -sourceserver "LV-SQL5" -sourcedatabase "TC_CTI" -sourcetable "CUSTOMER_1" -destinationserver "LV-SQL2" -destinationdatabase "TC_CTI" -destinationtable "CUSTOMER" -f "c:SQL_bat_Filessql5TC_CTIsql_filescustomer1"
the .sql file will be generated at: C:SQL_bat_Filessql5TC_CTIsql_filescustomer1.
The Problem:
The Execute Process Task is working fine, ie., the tables are being compared correctly and the .SQL file is being generated as desired. But the task as such is reporting faliure with the following error :
[Execute Process Task] Error: In Executing "C:SQL_bat_FilesSQL5TC_CTIpackage_occurrence.bat" "" at "C:Program Files (x86)Microsoft SQL Server90COM", The process exit code was "2" while the expected was "0". ]
Some of you may suggest to just set the ForceExecutionResult = Success (infact this is what I am doing now just to get the program working), but, this is not what I desire.
Can anyone help ?
View 9 Replies
View Related
Aug 20, 2014
I'm pulling data from Oracle db and load into MS-SQL 2008.For my data type checks during the data load process, what are options to ensure that the data being processed wouldn't fail. such that I can verify first in-hand with the target type of data and then if its valid format load it into destination table else mark it with error flag and push into errors table... All this at the row level.One way I can think of is to load into a staging table then get the source & destination table -column data types, compare them and proceed.
should I just try loading the data directly and if it fails try trouble shooting(which could be a difficult task as I wouldn't know what caused error...)
View 3 Replies
View Related
Feb 14, 2007
Hi Folks,
I am having this table locking issue that I need to start paying attention to as its getting more frequent.
The problem is that the data in the tables is live finance data that needs to be changed and viewed almost real time so what I have picked up so far is that using 'table Hints' may not be a good idea.
I have a guy at work telling me that introducing a data access layer is the only way to solve this, I am not convinced but havnt enough knowledge to back my own feeling up. (asp system not .net).
Thanks in advance
View 1 Replies
View Related
Jan 6, 2012
We are facing deadlock issue in our web application. The below message is coming:
> Session ID: pwdagc55bdps0q45q0j4ux55
> Location: xxx.xxx.xxx.xxx
> Error in: http://xxx.xxx.xxx.xxx:xxxx/Manhatta...Bar=&Mode=Edit
> Notes:
> Parameters:
> __EVENTTARGET:
> __EVENTARGUMENT:
[code].....
View 2 Replies
View Related
Feb 17, 2007
Hi,
I'm trying to upload the ASPNETDB.MDF file to a hosting server via FTP, and everytime when it was uploaded half way(40% or 50%)
I would get an error message saying:
"550 ASPNETDB.MDF: The process cannot access the file because it is being used by another process"
and then the upload failed.
I'm using SQL Express. Does anybody know what's the cause?
Thanks a lot
View 1 Replies
View Related
Nov 15, 2007
Hi. When I try to start a package manually clicking the Start Debugging button I get this after a little while:
Cannot process request because the process (3880) has exited. (Microsoft.DataTransformationServices.VsIntegration)
How can I prevent this from happening? This happens every time I want to start the package and
every time the process id is different. Here it is 3880.
Darek
View 13 Replies
View Related
Dec 20, 2006
select * from sysprocesses
How can I determine whether a process a system or user?
View 3 Replies
View Related
Oct 11, 2007
Hello,
I have had a full lock on my sql server and I have a few logs to found the origin of the lock.
I know the process at the head of the lock is the 55 process.
Here are the information I have on this process:
Spid 55 55
ecid 5 5
Ecid 0 0
ObjId 0 1784601646
IndId 0 0
Type DB PAG
Resource 1:1976242
Mode S IS
Status TransID GRANT GRANT
TransID 0 16980
TransUOW 00000000-0000-0000-0000-000000000000
00000000-0000-0000-0000-000000000000
lastwaittype PAGEIOLATCH_SH
CMD AWAITING COMMAND
Physycal id 1059
Login time 2007-07-05 04:29:53.873
nat address DFF06EBF974D
Wait type 0x0046
HostName .
BlkBy .
DBName grpprddb
CPUTime 54331
DiskIO 1059
ProgramName
Would someone know a way to identify the origin of the process 55?
I have already tried to execute the following request:
select * from SYSOBJECTS
where id=1784601646
But I have had no returns.
Regards,
Renaud
View 3 Replies
View Related
Aug 24, 2006
I have a File System Task Copy file operation to copy a file in an SSIS package. The package when scheduled as a job fails with the following error:
The process cannot access the file 'C:ETLConsignmentAppleAppleRawFile.txt' because it is being used by another process.".
However when I right click on the package and execute it manually from the Integration Services it runs successfully without any problem. I am not certain on how to resolve this issue any inputs will be much appreciated.
Thanks,
Monisha
View 19 Replies
View Related
Feb 6, 2008
Error: 0xC002F304 at Rename file 1, File System Task: An error occurred with the following error message: "The process cannot access the file because it is being used by another process.".
When running two File System Tasks after each other, with the same file, the file is still locked when running the second task. Resulting in an error: 0xC002F304 at Rename file 1, File System Task: An error occurred with the following error message: "The process cannot access the file because it is being used by another process.".
I found a workaround by addind a Execute Process Task before the second File System Task that pings to the localhost. This results in a 5 second delay, but there must be a better solution. Anyone?
View 9 Replies
View Related
Nov 23, 2006
While configuring log shipping using SQL 2000 Ent, the copy process failed with this message :
The process cannot access the file because it is being used by another process.
does anyone know what cause this ?
SAP R/3 is configured with the system, could this be the problem ?
View 3 Replies
View Related
Apr 7, 2008
i'm going nuts with SQL server notification thing. I have gone throigh this artical which tells how to set user http://www.codeproject.com/KB/database/SqlDependencyPermissions.aspx. This article show how to create new user and setup for sql server notification.But In my case user was alredy existing in database. which is very common senario in most cases. So i did following( check the SQL script below) but then i get this error
"A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)"
this my sql script
use [master]Go
-- Ensuring that Service Broker is enabled ALTER DATABASE [DatabaseName] SET ENABLE_BROKERGO
-- Switching to our databaseuse [DatabaseName]GO
CREATE SCHEMA schemaname AUTHORIZATION usernameGO
ALTER USER username WITH DEFAULT_SCHEMA = schemaname GO
/* * Creating two new roles. We're not going to set the necessary permissions * on the user-accounts, but we're going to set them on these two new roles. * At the end of this script, we're simply going to make our two users * members of these roles. */EXEC sp_addrole 'sql_dependency_subscriber' EXEC sp_addrole 'sql_dependency_starter'
-- Permissions needed for [sql_dependency_starter]GRANT CREATE PROCEDURE to [sql_dependency_starter] GRANT CREATE QUEUE to [sql_dependency_starter]GRANT CREATE SERVICE to [sql_dependency_starter]GRANT REFERENCES on CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification] to [sql_dependency_starter] GRANT VIEW DEFINITION TO [sql_dependency_starter]
-- Permissions needed for [sql_dependency_subscriber] GRANT SELECT to [sql_dependency_subscriber] GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [sql_dependency_subscriber] GRANT RECEIVE ON QueryNotificationErrorsQueue TO [sql_dependency_subscriber] GRANT REFERENCES on CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification] to [sql_dependency_subscriber]
-- Making sure that my users are member of the correct role.EXEC sp_addrolemember 'sql_dependency_starter', 'username'EXEC sp_addrolemember 'sql_dependency_subscriber', 'username'
View 10 Replies
View Related
Mar 19, 2008
Hi I am using VWD 2008, SQL Express 2005, Reporting Services, Win-XP, IIS5Basically let's say I have 2 pages:Page1: has a SQLDataSource control that populates a GridView from a table from a database file myDB.mdf (no code behind)Page2: has a reportviewer control that show a report with data from the same table from myDB.mdf from the reportserver, (no code behind)I have attached myDB.mdf to the SQL Server Express using the SQL Server Management Studio Express.If I first open Page2 to display the ReportViewer it works ok. or using the Report ManagerNow this is the problem:If after that I try to open Page1 then a get an error message:Cannot open user default database. Login failed.Login failed for user 'myServerASPNET'. Exception Details: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.Login failed for user 'myServerASPNET'.Then I have to restart the SQL Server to fix it,Now I can open Page1 ok, but if after this I try to open Page2 (ReportViewer) againThen I get this error:" An error has occurred during report processing. o Cannot create a connection to data source 'my_Datasource'. &And this error if open the report using the report manager:" An error has occurred during report processing. o Cannot create a connection to data source 'my_Datasource'. § Unable to open the physical file "C:InetpubwwwrootWebsiteApp_DatamyDB.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". &Now if i check the Management Studio Express again, you can see that myDB.mdf was detached. It seems to be there by it has no Tables or definitions, so I have to attach it again..Do you know how to fix this?Thanks in advance,Ed
View 5 Replies
View Related
Mar 21, 2001
Hi All,
I came across a weird problem in the morning in SQL Server 7.0 on NT Cluster Server.
* SP_WHO - returned a list of System Process IDs where ID = 6 shown as a sql server User comming from a web server
doing rollback on a stored procedure..
a) I tried to KILL the user but I couldn't.
b) Next I stopped the IIS service on Webserver and tried to KILL the user but still couldn't. Surprisingly the user was showing up as comming from
the same Webserver eventhough the IIS Service was not running.
* When I checked in the Current Status window of Enterprise Manager - the same Process ID was shown as SYSTEM User doing rollback on a stored
procedure.
Because of above user problem I was not able to do any Delete or update in the database. Also Restore of database failed because of the above user.
I could get rid of this problem only after STOPPING and STARTING the SQL Server Service.
Does any one one have any IDEA on this type of problem. If so Please let me why it happend and what needs to be done to resolve this from happening again
Thanks
Sekhar
View 3 Replies
View Related
Oct 17, 2006
Dear friends,
I'm working on 5 different servers,my work is to write the script and make it to run successfully.
I've two databases for me one to test the script and the other for the final script. after that i'l implement in other servers. after successful execution, the testing team will take care. now my problem is, some times i'm not able to find the exact script which was successfully runned.(on some servers, modifications were done.because some dependencies will be increased).
my question is how to maintain the exact script? may be this is a silly question, but after one week i'm not able to find the exact script.
please help me in this regard with your valuble suggesions.
Vinod
View 3 Replies
View Related
Jul 20, 2005
Hi,Please help.I have 2 tables as followings:CREATE TABLE [dbo].[Master] ([masitemno] [char] (10) NOT NULL ,[masqty] [decimal](10, 3) NOT NULL ,[masunitcost] [decimal](10, 2) NOT NULL) ON [PRIMARY]GOCREATE TABLE [dbo].[Transaction] ([transeqno] [int] NOT NULL ,[tranitemno] [char] (10) NOT NULL ,[tranqty] [decimal](10, 3) NOT NULL ,[tranamount] [decimal](10, 2) NOT NULL ,[tranunitcost] [decimal](10, 2) NOT NULL) ON [PRIMARY]GOALTER TABLE [dbo].[Master] WITH NOCHECK ADDCONSTRAINT [PK_Master] PRIMARY KEY NONCLUSTERED([masitemno]) ON [PRIMARY]GOALTER TABLE [dbo].[Transaction] WITH NOCHECK ADDCONSTRAINT [PK_Transaction] PRIMARY KEY NONCLUSTERED([transeqno]) ON [PRIMARY]GOTable "Transaction" has about 1,000,000 (one million rows) and Table"Master" has about 500,000 rows.I have to update "MASTER" table with "TRANSACTION" table withrow-by-row processing basis sorting byprimary key TRNSEQNO column.Sometimes TRANSACTION can explicitly SET "MASQTY" and "MASUNITCOST"columns (TRANUNITCOST<>0) of MASTERwhich linked byitemno and after that AMOUNT column of next row ofTRANSACTION will used thisnew UNITCOST of MASTER as followed statements.-------------------------------------------------declare @count int, @max intset @count=1set @max = (select max(seqno) from transaction(nolock)while @count<=@maxbeginupdate TRANSACTIONset TRANAMOUNT = TRANQTY * (select MASUNITCOST from MASTERwhere MASITEMNO=TRANITEMNO)where TRANSEQNO = @countand TRANUNITCOST = 0update MASTERset MASQTY = MASQTY + TRANQTYfrom TRANSACTIONwhere TRANSEQNO = @countand TRANUNITCOST = 0and MASITEMNO=TRANITEMNOupdate TRANSACTIONset TRANAMOUNT = TRANQTY * TRANUNITCOSTwhere TRANSEQNO = @countand TRANUNITCOST <> 0update MASTERset MASQTY = MASQTY + TRANQTY,MASUNITCOST = TRANUNITCOSTfrom TRANSACTIONwhere TRANSEQNO = @countand TRANUNITCOST <> 0and MASITEMNO=TRANITEMNOset @count = @count +1end-------------------------------------------------The above sample statements take me more than 10 hrs. (I quit beforeactually done) with MS SQL SERVER 7.5 SP4.on WIN2K SERVER (2 XEON PROCESSORS, 1GB MEM.). I tried to use triggerbut result is not correct.Please advise on shorten running time (in minutes , maybe) and betterperformance.Thank you and appreciate any suggestionsNipon Wongtrakul
View 5 Replies
View Related
Aug 21, 2007
Sorry but how do you configure to run IN PROCESS. My task runs like this in a BAT file
dtexec /f "\ssssagemetxteursAdminFCTestDTSXTest_AlexRename_file_alex.dtsx"
Thanks,
aL.
View 1 Replies
View Related
Dec 14, 2006
Hi
In installing sql express/management, during installion I get an error message when it comes to sql db services - It says setup failed because there is no process on the other end of the pipe.
Also, When I go to Start/All Programs/Microsoft Server 2005/Configuration Tool it says empty
This is running on Vista RC1
There is no way for me to enable remote connection
When I start Microsoft Sql Server Management Studio there is no server name to select from or choose from browseing
There is no sqlbrowser in SERVICES for me to start.
Also not install during installation is the work station component.
Any help?
Thanks
View 1 Replies
View Related
Feb 4, 2008
Dear all,
I'm starting an estimation exercise for an ETL/Datawarehouse project.
Does any of you knows a proven methodology and benchmark information to be able to estimate the overall effort of an ETL project. We have an idea on the number of tables/fields in the source systems, and a (very high-level) idea on the complexity of the different transformations.
Is there any website/document/whitepaper somewhere where an estimation technique is presented ?
Thanx
Maylo
View 1 Replies
View Related
Mar 9, 2007
I'm looking for Ideas on how to handle a Pldege Reminder process. For example; a pledge is made to pay $2400 over the next two years. They will pay $100 per month and each month a reminder will be sent. No real mistery if there is a balance you send a reminder. My problem is how to handle things like what if they want to pay quarterly or annually and how to determine if a payment is really due based on when they paid last, etc... You most likely see what I mean.
If anyone has done this in the past and/or has any ideas and is willing to share I would greatly appreciate any help.
Some stuff that may help you help me better:
tblClient (ClientID)
tblPledge (PledgeID, ClientID, PledegedAmt, PledgeDate,Frequency,NumberYears)
tblPledgePayments (PmtID, PledgeID,PmtAmt,PmtDate)
View 3 Replies
View Related
Jun 18, 2007
I'm going to design a web page for students parking permit application.I'm new to asp.net, I have a process in mind doing it like this:
The form asks student to choose a permit type, then fill in applicant info, like name, grade, vehicle info, student may have 2 vehicles, and payment method, check or credit card,
I plan to create 3 tables like tblPermit, tblapplicant, tblVehicle.After the students fill in the form, click submit button, I pass the values and call a stored procedure, some thing like this.Dim Cmd As New Data.SqlClient.SqlCommand(MySQL, MyConn)
Cmd.CommandType = Data.CommandType.StoredProcedure
Then in the stored proceudre, I will do :
Begin
insert into Permit table, then get permitID, by using something like this:Select @PermitID=@@Identity
Then insert into Student table, then use
Select @StudentID=@@Identity
Then insert into vehicle table.
All the above 3 processes I put it in begin, end--So that they will not messed up with other applicants data.
I think begin...end is one transaction.
SO am I doing correctly this way? Thanks
View 2 Replies
View Related
Mar 27, 2001
Hi all,
I have SQL Server 7.0 with SP2 on it and I am not able to kill one of the SPID's who is running a SELECT Statement.
When I saw in the current activity in EM I see the STATUS as ROLLBACK, COMMAND as SELECT, APPLICATION as MS SQLEM-DATATOOLS, WAITTIME as 5375 and WAITTYPE as CXPACKET..
I also tried to reboot the machine of that particular SPID , but it still shows up in the Enterprise Manager.
Can anyone tell me how to kill this process and how to get around this Problem
Any Ideas,
Thanks in Advance
Venu
View 4 Replies
View Related