Connecting Tech Pros Worldwide Forums | Help | Site Map

CONVERT() problem

mezzanine1974
Guest
 
Posts: n/a
#1: Jul 17 '08
In access query, i can use following expression to show "AnyInteger"
in the format of "0000"

CStr(Format(AnyInteger,"0000"))

eg:
12 yields to 0012
8 yields to 0008

how should i use CONVERT() function in SQL SERVER to achive my goal
please?


Madhivanan
Guest
 
Posts: n/a
#2: Jul 17 '08

re: CONVERT() problem


On Jul 17, 6:54*pm, mezzanine1974 <savas_karadu...@yahoo.comwrote:
Quote:
In access query, i can use following expression to show "AnyInteger"
in the format of "0000"
>
CStr(Format(AnyInteger,"0000"))
>
eg:
12 yields to 0012
8 yields to 0008
>
how should i use CONVERT() function in SQL SERVER to achive my goal
please?

Formation matters only if you want to show them in front end
application. Otherwise use

Select right('0000'+cast(anyinteger as varchar(4)),4)
mezzanine1974
Guest
 
Posts: n/a
#3: Jul 17 '08

re: CONVERT() problem


hi Madhivanan,
it is working excellent!
Thanks
Madhivanan
Guest
 
Posts: n/a
#4: Jul 28 '08

re: CONVERT() problem


On Jul 17, 7:31*pm, mezzanine1974 <savas_karadu...@yahoo.comwrote:
Quote:
hi Madhivanan,
it is working excellent!
Thanks

You are welcome [:)]
--CELKO--
Guest
 
Posts: n/a
#5: Jul 28 '08

re: CONVERT() problem


In a tiered architecture, formatting and display are done in the front
end and not the database.

You will need about a year to UN-learn ACCESS (monolithic single user
desktop design) and start writing SQL (tiered, multi-user, client
server).


mezzanine1974
Guest
 
Posts: n/a
#6: Aug 25 '08

re: CONVERT() problem


You will need about a year to UN-learn ACCESS (monolithic single user
Quote:
desktop design)
It sounds to me very dramatical (


--CELKO--
Guest
 
Posts: n/a
#7: Aug 25 '08

re: CONVERT() problem


>It sounds to me very dramatic <<

No, that estimate of a year of un-learning is based on being involved
with the ANSI/ISO Standards, teaching SQL and RDBMS for a few decades,
and writing eight books on the topic.

"Perfecting oneself is as much unlearning as it is learning." --
Edsger Dijkstra

Closed Thread