Viewing 15 posts - 301 through 315 (of 898 total)
One more way to do this..
; WITH cte_Temp1 AS
(
SELECTT1.*, T2.mytab1col1 AS mytab1col1_T2
FROM##Temp1 AS T1
CROSS JOIN(
SELECTDISTINCT T2.mytab1col1
FROM##Temp2 AS T2
) AS T2
)
SELECTT1.mytab1col1, T1.mytab1col1_T2
FROMcte_Temp1 AS T1
LEFT OUTER JOIN##Temp2 AS T2 ON T1.mytab1col1_T2 =...
April 25, 2013 at 6:15 am
You will probably need a trigger which will update the value of the 3rd column when you enter or update a row in your table.
April 24, 2013 at 5:51 am
Something like this
DECLARE@tbl_Customer TABLE
(
Customer_idINT,
ValueNUMERIC(18,2)
)
DECLARE@tbl_Relation TABLE
(
Customer_idINT,
Child_idINT
)
INSERT@tbl_Customer
SELECT1, 100 UNION ALL
SELECT2, 150 UNION ALL
SELECT3, 1000 UNION ALL
SELECT4, 300 UNION ALL
SELECT10, 120 UNION ALL
SELECT11, 150 UNION ALL
SELECT12, 1000 UNION ALL
SELECT13, 200
INSERT@tbl_Relation
SELECT1, 10 UNION ALL
SELECT1,...
April 19, 2013 at 8:21 am
You can create a table variable or a temporary table holding all the months and then do a LEFT OUTER JOIN with this table
DECLARE@tblCalendar TABLE
(
Month_NameVARCHAR(20),
Month_NumTINYINT,
Year_NumSMALLINT
)
INSERT@tblCalendar
SELECT'January', 1, 2013...
April 19, 2013 at 4:06 am
Something like this
SELECTH.CtryId, H.WrkflwId, H.Dt
FROMstepHistory H
INNER JOIN(
SELECTWrkflwId, ctryId, MAX( DtTm ) AS DtTm
FROMstepHistory
GROUP BY WrkflwId, ctryId
) AS SH ON H.WrkflwId = SH.WrkflwId AND H.CtryId = SH.CtryId AND H.DtTm = SH.DtTm
WHEREH.SteTyId...
April 19, 2013 at 2:56 am
sugiarttampubolon (4/18/2013)
the detail is make a store procedure from 2 database
master_db and temporary_db but i cannot touch the source program just make stored procedure...
April 18, 2013 at 6:20 am
Decimals are not a good data type to store time
You have given 06:20 and 19:00 as sample data which doesn't look like decimals
Are you sure the data type is decimal...
April 18, 2013 at 3:27 am
I would help the OP if I feel the person has taken some effort in trying to find answers themselves and is not plain lazy.
I have found numerous posts where...
April 18, 2013 at 3:19 am
This should do the work for you
SELECTCASE WHEN C.active_flag = 1 THEN 'Active' ELSE 'Inactive' END AS active_flag,
C.name, C.company_code,
SUM( CASE WHEN P.active_flag = 1 AND P.unregister_flag = 0 THEN 1...
April 18, 2013 at 2:22 am
kapil_kk (4/17/2013)
Nice question... learn something new today.. 🙂But can anyone plz explain me about the SUM part which is returning 12, I am not clear with this section :w00t:
Change the...
April 17, 2013 at 11:32 pm
Not sure but I hope this is what you need
SELECTA1.*, COALESCE( A1.fg_eff_dt_key, 20790606 ) - COALESCE( A2.fg_eff_dt_key, 20790606 ) AS DiffDays
FROMabc AS A1
LEFT OUTER JOINabc AS A2 ON A1.fg_seq_nbr =...
April 17, 2013 at 6:22 am
kapil_kk (4/17/2013)
Lowell (4/17/2013)
ALTER TABLE [dbo].[GV_STNDetails]ADD STN AS RIGHT('0000' + CONVERT(VARCHAR,[From_StoreCode]),4) +RIGHT('000000' + CONVERT(VARCHAR,[STNID]),6)...
April 17, 2013 at 5:54 am
kiran.rajenimbalkar (4/17/2013)
if end date column would be null then pls treat as 20790606please check only fg_end_dt_key column
(20790606-20130416) ---660190
(20130416-20130128) --288
(20130128-20130128) --0
This doesn't seem to be...
April 17, 2013 at 5:24 am
kapil_kk (4/17/2013)
Please help me on this...
The scenario that you have mentioned is not very clear.
It would be good if you can explain your issue with some DDL and sample data...
April 17, 2013 at 5:13 am
kiran.rajenimbalkar (4/17/2013)
not getting proper result Sir.I have tried.
Can you also post the expected result based on your sample data?
That will help people understand what you need exactly.
April 17, 2013 at 4:55 am
Viewing 15 posts - 301 through 315 (of 898 total)