im also thinking that i will need when i try convert
to put it into the style code either
code 20 or 120 yyyy-mm-dd hh:mi:ss(24h)
so thats 24 hour which is what i need and then rip the separators
or in code 126 below so theres no spaces, but i dont think thats 24 hr representation
code 126 yyyy-mm-dd Thh:mm:ss.mmm(n o spaces)...
User Profile
Collapse
-
quick date conversion - not hard!
im trying to convert my column of data type datetime. this is an example of what the data looks like:
2007-01-24 10:01:29.710
i want to format it as so
200701241001
ive tried this so far i think im sort of on the right track
RIGHT('00000000 0000' + CONVERT(varchar (20), CONVERT(int, sr.ResponseDate )),12) AS FinalDate
but its not outputting exactly what i want... -
-
heres the offending code
declare @a varchar(10)
declare @b varchar(10)
SELECT DateEntered, dbo.Site.SiteCo de AS SiteCode, ('0' + DepartmentID) AS FuelCode, convert(varchar (10),CurrentPri ce)
FROM dbo.vwCurrentFu elPrice, dbo.Site
WHERE dbo.vwCurrentFu elPrice.SiteID = dbo.Site.SiteID
set @a = convert(varchar (10),dbo.vwCurr entFuelPrice.Cu rrentPrice)
set @b =Replace(@a,'.' ,'')...Leave a comment:
-
all of the code works perfectly fine, the thing is thought, that in dbo.vwCurrentFu elPrice there has a column CurrentPrice that i want to format in the way i described above. i want to be able to get it every time without having to manually enter the prices 1.1490 etc. thats how it gets put in if you get my drift.. thanks!Leave a comment:
-
price formatting
ok, i have a column of data type money and the data that is found in there is entered like this
1.1490
1.2340
1.0590
0.5990
0.5380
what i want to do is have it formatted as such
1149
1234
1059
0599
0538
ive tried using cast, convert, from money to varchar and simplying multiplying the field, replace and trunc but its not happening !!! any code...
No activity results to display
Show More
Leave a comment: