Convert Number To Time
Apr 2, 2008
In my database times are stored as integers. Therefore if someone arrives a 1am the value is 60, 2am 120 etc. Is there a way to convert these integer values to 1:00, 2:00. I've tried converting to a decimal so if somene arrives at 1:30 it returns 1.5, but I still only get the integer value...
CONVERT(decimal(10,2), (90/60)) AS iStart
Thanks in advance
Roy
View 2 Replies
ADVERTISEMENT
Aug 7, 2007
Hi all,
I have created a report in SSRS 2005 which is being viewed by users from different Time Zones.
I have a dataset which has a field of type datetime (UTC). Now I would like to display this Date according to the User Time Zone.
For example if the date is August 07, 2007 10:00 AM UTC,
then I would like to display it as August 07, 2007 03:30 PM IST if the user Time Zone is IST.
Similarly for other Time Zones it should display the time accordingly.
Is this possible in SSRS 2005?
Any pointers will be usefull...
Thanks in advance
sudheer racha.
View 5 Replies
View Related
Aug 15, 2006
Dear Experts,Ok, I hate to ask such a seemingly dumb question, but I'vealready spent far too much time on this. More that Iwould care to admit.In Sql server, how do I simply change a character into a number??????In Oracle, it is:select to_number(20.55)from dualTO_NUMBER(20.55)----------------20.55And we are on with our lives.In sql server, using the Northwinds database:SELECTr.regionid,STR(r.regionid,7,2) as a_string,CONVERT(numeric, STR(r.regionid,7,2)) as a_number,cast ( STR(r.regionid) as int ) as cast_to_numberFROM REGION R1 1.00112 2.00223 3.00334 4.0044SELECTr.regionid,STR(r.regionid,7,2) as a_string,CONVERT(numeric, STR(r.regionid,7,2) ) as a_number,cast (STR(r.regionid,7,2) as numeric ) as cast_to_numberFROM REGION R1 1.00112 2.00223 3.00334 4.0044Str converts from number to string in one motion.Isn't there a simple function in Sql Server to convertfrom string to number?What is the secret?Thanks
View 4 Replies
View Related
Sep 24, 2007
Hi
I want to enter rows into a table having more number of columns
For example : I have one employee table having columns (name ,address,salary etc )
then, how can i enter 100 employees data at a time ?
Suppose i am having my data in .txt file (or ) in .xls
( SQL Server 2005)
View 1 Replies
View Related
Dec 4, 2007
I have two fields which im trying to convert to standard time. IE (09:05 PM) or (12:00 AM).
They are in Military format right now. so i have 15:45 and 21:30 etc etc.
They are both Chars. And its just times and no dates. Can anyone help??
View 7 Replies
View Related
Oct 28, 2007
Hi all.
I have posted this question in another forum but no one has so far been able to provide a solution to the problem. Since I know Database Journal always has very informative and enlightening posts, I figured I'd post the question here in hopes that some guru can provide an answer.
If you're running SQL 2000 and have any jobs that have been executed, you could perform a query as such:
select last_run_time from msdb.dbo.sysjobsteps
and receive returned values that contain the last time a job was executed "stored in integer datatype" columns. See ->
sp_help sysjobsteps.
In SQL 2005 I believe the concept is the same. I think the intent of Microsoft had it mind for doing this was to store the date separate from the time values which won't work using the datetime datatype and I have read this in documentation in the past.
The challenge is to convert that data into a humanly legible 12 or 24 hour time format like 11:00 AM or 02:45:39.
Does anyone have any suggestions or clues to assist in resolving this problem??? :(
Thanks.
View 6 Replies
View Related
Dec 29, 2005
Hello,
I am new with the reporting services. I am creating a report and I need to display date/time on the report. But the servers stores those date/time in UTC. How can I convert them to the local time in my report.
Thanks for your help.
View 13 Replies
View Related
Jul 7, 2006
I search the help for T-sql, still don't know how to convert a number, for example 12345 to a string with formating like 12,345
Thanks for your help.
View 1 Replies
View Related
Apr 25, 2001
Hi
In my MSSSQL database I have a table that contains "AGE" and its datatype is varchar.
I want to calculate the min(age) and max(age).
But the AGE field's datatype is varchar and I canot do any mathematical functions.
In Oracle There is a code for doing that.I think this is the code
select max(tonumber(age));
what is it's MSSQL equivalent.
thanks
sabu
View 2 Replies
View Related
Dec 4, 2007
Using SQL 2005. I have a field with dollar amounts but field type is VarChar. Need to convert to number to sum. What's the best way to do this or how can I sum a field type Varchar that has dollar amounts. Thank you, David
View 2 Replies
View Related
May 23, 2012
i have 001747254 and 000096710 in column 'price'i want it to display as 17472.54 and 967.10how can i do this in one query?
View 4 Replies
View Related
Dec 6, 2014
I have a column which keeps numeric data in form of String, but I want to convert it to number e.g. from "1001" to 1001,
Which function I can use to do it?
[URL] .....
View 2 Replies
View Related
Jul 19, 2006
hi,
I have a bit string like '000111010101101110000111' , how to convert it to varbinary format like 0x1D5B83?
Thanks.
View 1 Replies
View Related
Sep 5, 2007
Flat file has a data like 6.49146E+11.
How to convert this to 649146029310.
Whats the syntax for derived column component ?
Thanks.
View 2 Replies
View Related
Oct 9, 2007
I have a column in a table that stores the number of hours a task took to do. The column TaskDuration is a datetime datatype. I need to convert the hours to something that can be summed. Does anyone how this can be done? I tried CONVERT(nvarchar(5), tblTasks.TaskDuration, 108) but of course the nvarchar(5) cannot be summed. Maybe there is a way to convert the time portion to minutes and divide it by 60, anyway if someone can offer some help I appreciate it.
View 5 Replies
View Related
Oct 17, 2006
Good Day to Everyone,
Need help!
I have this SQL table w/ fieldname "PayPeriod". Sample value of PayPeriod are SEP06-1, SEP06-2, OCT06-1, OCT06-2... Wherein the first 3 chars is the month, 06 is the year, 1 or 2 is the cutoff where 1 means the 2nd half of the previous month and 2 is the first half of the current month.
Now my questions are:
1.) How can I select these values sorted according to date. Since this is a character data type. Sorting is alphabetical. I need to sort it according to date where JAN05-1 is the first record and the last record is DEC06-2 (assuming that the oldest year is 05 and 06 is the latest).
2.) How can I convert the 3 char month into its number equivalent. Example, JAN is equal to 1, FEB is 2, MAR is 3....
3.) How can I count the no. of days in a month? Is there a function that would result to the no. of days in a given month?
Thank you so much in advance. :)
View 6 Replies
View Related
Apr 11, 2014
I have one table called tblCustomer.I have done a SQL select query
Select SalesDate, OrderNo
From tblCustomer
Table 1 is result of SQL
OrderID is Primary Key
There are two fields I want to convert to number starting with prefix C on each row then followed by combining SalesDate + OrderNo
SalesDate OrderNo
01/1/2014 0678
12/1/2014 9099
15/1/2014 8745
I need to covert this two field into one field which I want it to start with Prefix C AS SalesOrdeNumber column.Find below example what I want after completing this exexercse.Table 2 third column (SalesOrdeNumber) is what I need as result of Concatenation (SalesDate+ OrderNo +C)
SalesDate OrderNoSalesOrdeNumber
2014/01/20 0678 C 1401200678
2013/09/259099 C 1309259099
2013/04/308745 C 1304308745
SalesOrderNumber is made by combining SalesDate +OrderNo Fields (yymmdd+OrderNo+C (as prefix on every row))
Point to Note
Date Format on SalesDate Field YYYY-MM-DD
OrderNo field is maximum digit is 4
View 4 Replies
View Related
Apr 30, 2015
I want to convert date to week consider saturday is first day of week and friday is end of week. for input is orderdate and output should be week. example orderdate 11.04.15 to 17.04.15 week should be 16. orderdate 18.04.15 week should change to 17.
Order DateWeek
11-Apr-201516
12-Apr-201516
13-Apr-201516
14-Apr-201516
15-Apr-201516
16-Apr-201516
17-Apr-201516
Order DateWeek
18-Apr-201517
View 3 Replies
View Related
Nov 26, 2007
Hi
I have a field (int) thats a value in seconds.
I need to add it to a datetime value to get a finish time ..
how can i convert it to datetime (baring in mind its seconds)
so far any conversion i do converts it to days...
View 2 Replies
View Related
Jan 18, 2008
I was just wondering if there is a way of converting a number from negative to positive within Reporting Services, ie remove the "-" sign from the front of the number? One of the columns within my report contains a calculation which results in an integer, but it is always a negative number, even though it should really be positive (it would take too long to describe the exact reason for this, but it's to do with the underlying database, which I don't have access to anyway). When I right-click on the relevant cell within the table in Layout view in the Report Designer and go to Expression, there is a list of Conversion functions under the "Common Functions" heading but I can't find anything there which would convert a number from negative to positive. Does anyone know how this can be achieved?
View 5 Replies
View Related
Apr 2, 2014
I seem to always get the "Fun Stuff" to try and figure out. I have an entire table that was pumped out of Oracle. I even hate saying that word!
There are a couple columns that are Float data type, and they are storing phone numbers as a Float data type. I am not able to CAST these into anything that is legible.
This is one of the values that I made up that look like some of the others.
9.72732e+009
View 2 Replies
View Related
Sep 1, 2014
I'm stuck on converting a datetime field to Int. Basically, one of the fields in the select returns the datetime of a journey. However I need to be able to add up the number of days for a specific person who done that journey, e.g. it will return 21/08/2014, 22/08/2014 etc...
I then need to total up the days as a new field to display the number of days.
Can you do this by converting a datetime to int then use COUNT on the int?
View 1 Replies
View Related
Feb 28, 2008
hi guys,
How could I convert 'week 9 2008' back into the first day of that week ?
is that even possible ?
View 5 Replies
View Related
Feb 4, 2008
I'm working with a horrible database! The field I'm having issues with is a negative number stored as a nvarchar, but it's not stored in a consistent format. I need to convert the field to a decimal (9,2) but I can't because of the negative sign.
Example:
Balance
00000000
0000-413
0000-913
00-10913
00009526
I don't even know where to start to convert this. Any help is appreciated!
Thanks.
View 10 Replies
View Related
Sep 14, 2007
I would like to convert a number into fixed format string. Say for example if I have number 5, I would like to show it as four charactered string:
0005.
In case if I have 33, then I would like to have a result like '0033'. Please let me know the string functions with which I can acheive this.
View 5 Replies
View Related
Aug 2, 2009
I have a field that contains number but it actually is character. I want to convert it to number so i can put it into query like this:
sum(field) as Totalmyfield.
View 6 Replies
View Related
May 8, 2008
Guys,
Need ur help on this...how can I change the datetime stamp to GMT in a table, it's a SQL Server 2005 database.
The timestamps are EST,PST,CT...
so have to change the arrival and departure times to GMT time zone
Thanks,
JohnB
View 4 Replies
View Related
May 30, 2008
I have a field that displays seconds. I need to convert it to hours/min/sec.
For example,
Seconds convertedValue
90 1 min 30 sec
60 1 min 0 sec
95 1 min 35 sec
Is this possible? Or maybe this would be easier:
Seconds convertedValue
90 00:01:30
60 00:01:00
95 00:01:35
Thanks,
Ninel
View 2 Replies
View Related
Aug 16, 2006
I have an integer field that has time values.
Here is what I have and what I want.
Example:
0 = "12:00:00 AM"
345 = "12:03:45 AM"
152341 = "3:23:41 PM"
Is this possible.
View 2 Replies
View Related
Nov 3, 2006
I have a DB that gets telephone call information from a telephone switch. We use 3rd part software and a db to capture all of this. However for some reason most of the fields are stored as int DateTime is stored as an int. I am able to convert most of the date field from int by doing select convert(datetime,convert(varchar(8), localday)) that works fine the int are in the db as 20061029 for 10-29-2006.
How ever I can't convert the columns starttime and endtime. They are also stored as int but
They don't seem to store a date.
For instance for the date 9/29/2006 the start time of one particular call is
1159533056 and the endtime is 1159533264 All i need to get from this is the time since I already have the date from another column. I can't figure out what this data represents.
How can I convert this to datetime?
Thanks!
View 6 Replies
View Related
Aug 21, 2007
Hi,
Hopefully this is an easy one. I need a function to call from my page footer that takes the NOW date/time value and converts it from Eastern Standard Time to Mountain Standard Time. (My server is on EST time and my users are all on MST time) Of course the function needs to handle daylight savings as well.
thanks!
View 11 Replies
View Related
Apr 5, 2014
I'm new to SQL and I've been trying this for a while now.
I have let's say a loop of numbers from one to ten. It appears like this:
1
2
3
4
5
What I want to do is to have it appear on one column like this: 12345, the problem is I can't seem to figure out if I need to only have one variable or I'm missing something else, I figured you need to convert them into a string character but I'm still unable to do it.
View 7 Replies
View Related
May 3, 2007
Convert Time Zone:
I have 05/02/2007 10:00AM CST, how can I convert this to EST in SQL Server 2000 function?
View 3 Replies
View Related