Click here to Skip to main content
15,919,613 members
Home / Discussions / Database
   

Database

 
QuestionRe: Shrink Problem After Compress Pin
Richard MacCutchan31-Jan-15 6:15
mveRichard MacCutchan31-Jan-15 6:15 
QuestionOracle Connection User Name and Password [UPDATE] Pin
Kevin Marois30-Jan-15 11:24
professionalKevin Marois30-Jan-15 11:24 
Questionhow can i transfer data Pin
Member 1141305829-Jan-15 12:55
Member 1141305829-Jan-15 12:55 
AnswerRe: how can i transfer data Pin
Mycroft Holmes29-Jan-15 13:41
professionalMycroft Holmes29-Jan-15 13:41 
GeneralRe: how can i transfer data Pin
Member 114130581-Feb-15 5:23
Member 114130581-Feb-15 5:23 
AnswerRe: how can i transfer data Pin
Umer Akram29-Jan-15 18:52
Umer Akram29-Jan-15 18:52 
GeneralRe: how can i transfer data Pin
Member 114130581-Feb-15 5:24
Member 114130581-Feb-15 5:24 
GeneralRe: how can i transfer data Pin
Umer Akram3-Feb-15 18:43
Umer Akram3-Feb-15 18:43 
QuestionModify the computed expression of computed column Pin
indian14327-Jan-15 6:41
indian14327-Jan-15 6:41 
AnswerRe: Modify the computed expression of computed column Pin
Richard Deeming27-Jan-15 7:02
mveRichard Deeming27-Jan-15 7:02 
AnswerRe: Modify the computed expression of computed column Pin
deepakdynamite28-Jan-15 0:27
deepakdynamite28-Jan-15 0:27 
QuestionBLOB or external storage... Pin
Kornfeld Eliyahu Peter26-Jan-15 20:57
professionalKornfeld Eliyahu Peter26-Jan-15 20:57 
AnswerRe: BLOB or external storage... Pin
den2k8826-Jan-15 21:32
professionalden2k8826-Jan-15 21:32 
AnswerRe: BLOB or external storage... Pin
GuyThiebaut26-Jan-15 21:48
professionalGuyThiebaut26-Jan-15 21:48 
AnswerRe: BLOB or external storage... Pin
Jörgen Andersson26-Jan-15 22:13
professionalJörgen Andersson26-Jan-15 22:13 
AnswerRe: BLOB or external storage... Pin
Richard Deeming27-Jan-15 1:50
mveRichard Deeming27-Jan-15 1:50 
GeneralRe: BLOB or external storage... Pin
Jörgen Andersson27-Jan-15 3:06
professionalJörgen Andersson27-Jan-15 3:06 
AnswerRe: BLOB or external storage... Pin
deepakdynamite28-Jan-15 0:30
deepakdynamite28-Jan-15 0:30 
QuestionDatediff function Pin
Ambertje26-Jan-15 2:18
Ambertje26-Jan-15 2:18 
AnswerRe: Datediff function Pin
Chris Quinn26-Jan-15 2:25
Chris Quinn26-Jan-15 2:25 
GeneralRe: Datediff function Pin
Ambertje26-Jan-15 2:34
Ambertje26-Jan-15 2:34 
GeneralRe: Datediff function Pin
Chris Quinn26-Jan-15 2:42
Chris Quinn26-Jan-15 2:42 
GeneralRe: Datediff function Pin
Ambertje26-Jan-15 3:12
Ambertje26-Jan-15 3:12 
Hi Chris,

I need my dates as string because I'm working with a Data warehouse DB.

SQL
, CAST(Replace(convert(date, [START_DATE], 101), '-', '') as numeric(8,0))                              AS [START_DATE]

, CAST(dbo.LPAD(dbo.CONVERT_TIME_TO_NUMERIC(SUBSTRING(dbo.arKD.START_TIME,1,8)), 6, 0)AS nvarchar(6))   AS START_TIME

, CAST(Replace(convert(date, END_DATE, 101), '-', '') as numeric(8,0))                                  AS END_DATE

, CAST(dbo.LPAD(dbo.CONVERT_TIME_TO_NUMERIC(SUBSTRING(dbo.arKD.END_TIME,1,8)), 6, 0)AS nvarchar(6))     AS END_TIME

--DATEDIFF(interval, Starting_date datetime, ending_date datetime)
,Datediff(SECOND,
     convert(datetime, [START_DATE] + ' ' + [START_TIME]),
     convert(datetime, [END_DATE] + ' ' + [END_TIME]))                                                  AS M_Time_Worked


This is actual code where I Cast all dates to nvarchar.

So how can I change this code in a way that I can set the Start_Date (when empty) to the value of End_Date and Start_Time to the value of End_Time when empty?

I'm not an experienced developer, I'm still learning and hope you can learn me something new.

Kind regards,
Ambertje
GeneralRe: Datediff function Pin
Chris Quinn26-Jan-15 3:18
Chris Quinn26-Jan-15 3:18 
GeneralRe: Datediff function Pin
Ambertje26-Jan-15 3:26
Ambertje26-Jan-15 3:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.