SQL Server CE: how to save an amound of time? -


i need save amount of time (3 days, 1 month, 5 years, etc).

datetime seems saving date , time (4/5/14 21:03). save number of days number, able save in different units (days, weeks, months...)

is there way of doing it?

sql dynamic datepart when using datediff

so stuck dynamic sql or using case statement.

basically, need store datepart , number apply dateadd (datepart , number , date) date. splitting 1 string on each value might resource-consuming, might best use 2 separate fields: char(1) datepart , smallint (-32,768 32,767 should enough) number save on storage space.

without user functions , dynamic sql support in sql server compact option implement logic seems through case statement:

select    case [datepart]     when 'y' dateadd (yy, [number], [date])     when 'm' dateadd (mm, [number], [date])     when 'w' dateadd (ww, [number], [date])     else          dateadd (dd, [number], [date])   end [new date] ... 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -