This should subtract 2 months of the current date:
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH,calendar.get(Calendar.MONTH)-2);
int month = calendar.get(Calendar.MONTH));
You cannot get the month name out in the way you want so, just the month number - you could...
You are using a datetime field and this must have a date part and a time part. Because you did not enter a date, only a time, SQL Server filled in the date part for you using the default date value of 1/1/1900.
Richard
Hi, If no date is supplied the default of january 1, 1900 is assumed. As you are only entering the time part into a datetime filed that is what is happening. Try the following to get only the time part out
convert(varchar,iTimeOut, 108)
Richard
If the only reason you're using dynamic SQL is because of the comma delimited list, you could delegate parsing the list to a user defined function. The udf should convert your delimited list into a temporary table which you can use in a normal table join - this removes the need to build dynamic...
Hi,
I have successfully imported several million records from Oracle using the DTS. The DTS import wizard is pretty good for getting started and gives you a lot of flexibility if you need to do any transformations on your data as you migrate it.
Richard
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.