Hi,
I'm doing an online invoice system with ASP and MS SQL.
So you got the price and total amount.
And let say the amount is $4000.00 , there is also a portion where the invoice needs to mention it in words, "Fourty Thousand"
Can it be "cast" ? "conver" ? or anything?
Or is there any workaround??$4000.00 = "Fourty Thousand"
I better should be careful while doing any transactions with you ;).
Maybe a function can be written to get it done ... will try it out ...
Highly unlikely you will get a readymade function for the same ...|||Opps..sorry...I was kindy sleepy..:)
thanks...I'll be trying out some code too...so many numbers condition to check in the if then else....|||don't write your own, there are so many scripts out there already, i'm sure you can adapt the logic, even if they aren't all written in wahtever language you plan to use...
http://developer.asna.com/Articles/b000106.asp
http://www.idinews.com/sourcecode/IntegerFunction.html
http://www.mvps.org/access/modules/mdl0001.htm
http://www.vbce.com/code/functions/convert_numbers_to_words/index.asp
http://www.vbexplorer.com/VBExplorer/tips/src36.asp
how did i find these so quickly?
google
Showing posts with label invoice. Show all posts
Showing posts with label invoice. Show all posts
Sunday, February 19, 2012
Friday, February 10, 2012
Convert Date with T-SQL
Hi,
problem with transact-SQL (SQL2k). I'm gathering informations from2 different tables and the column that interest me (the invoice date) have same format but not filled in the same. One is an old table and the format is "datetime" (but written like dd/mm/yyyy) and the new one "datetime" as well but "dd/mm/yyyy hh:mm:ss" (and it's not small datetime)
I'd like to convert the date format wich appears with the "hh:mm:ss" to a smaller format (just dd/mm/yyyy).
I'v tried with the conversion into text (the CONVERT function limits) wich works but I need to deal with a date format when I get the result. If I re convert to smalldatetime, I get the hh:mm:ss again.
Hope this clear.
ThanksDDL and some sample data would be a BIG help...|||SQL Server always stores the date and time. There isn't any way to change that.
You can change how your client displays what SQL Server returns. I think that is what you need to address.
-PatP|||Select ShortInvoiceDt = CONVERT(VARCHAR(10), NewerInvoiceDate, 101)
FROM NewerTable
Use the client app to format accordingly. For example, are you using Access? Crystal? VB?|||I'm testing differents client apps, like Business Object and Harry soft as the data are re stored in a datawarehouse DB.
And yes, seems I don't have the choice, deal with the client App.
Brett, Do you need more details like example?
Thanks for your posts, I'll spare time now searching on the wright place.
Cheers|||In addition to the other reply's,
maybe this will also help some people who read this topic...
------------------
declare
@.invoice_date datetime,
@.new_date varchar(10)
set @.invoice_date = getdate()
-- 'Cut' the time part
select @.new_date = convert(varchar,@.invoice_date,103)
-- Display date
select @.new_date as new_date
-- Work with the date in date format with the time set to zero and convert it later to character for displaying
-- only the date without time part
select convert(datetime,@.new_date,103) as working_date
problem with transact-SQL (SQL2k). I'm gathering informations from2 different tables and the column that interest me (the invoice date) have same format but not filled in the same. One is an old table and the format is "datetime" (but written like dd/mm/yyyy) and the new one "datetime" as well but "dd/mm/yyyy hh:mm:ss" (and it's not small datetime)
I'd like to convert the date format wich appears with the "hh:mm:ss" to a smaller format (just dd/mm/yyyy).
I'v tried with the conversion into text (the CONVERT function limits) wich works but I need to deal with a date format when I get the result. If I re convert to smalldatetime, I get the hh:mm:ss again.
Hope this clear.
ThanksDDL and some sample data would be a BIG help...|||SQL Server always stores the date and time. There isn't any way to change that.
You can change how your client displays what SQL Server returns. I think that is what you need to address.
-PatP|||Select ShortInvoiceDt = CONVERT(VARCHAR(10), NewerInvoiceDate, 101)
FROM NewerTable
Use the client app to format accordingly. For example, are you using Access? Crystal? VB?|||I'm testing differents client apps, like Business Object and Harry soft as the data are re stored in a datawarehouse DB.
And yes, seems I don't have the choice, deal with the client App.
Brett, Do you need more details like example?
Thanks for your posts, I'll spare time now searching on the wright place.
Cheers|||In addition to the other reply's,
maybe this will also help some people who read this topic...
------------------
declare
@.invoice_date datetime,
@.new_date varchar(10)
set @.invoice_date = getdate()
-- 'Cut' the time part
select @.new_date = convert(varchar,@.invoice_date,103)
-- Display date
select @.new_date as new_date
-- Work with the date in date format with the time set to zero and convert it later to character for displaying
-- only the date without time part
select convert(datetime,@.new_date,103) as working_date
Subscribe to:
Posts (Atom)