Results 1 to 4 of 4

Thread: Substitute for format function

  1. #1
    Join Date
    Mar 2003
    Posts
    16

    Substitute for format function

    I've a Field with following data

    12
    12.4
    23.44
    4.5

    if I run a query

    SELECT format(field,'#0.00') from table1

    it gives the following output in Ms-Access

    12.00
    12.40
    23.44
    4.50


    HOW DO I DO THE SAME FOR SQL SERVER 7.0

  2. #2
    Join Date
    Feb 2003
    Posts
    102

    USE THE CAST FUNCTION

    Hi Kaur,

    --Put this in Query Analyser and hit F5
    SELECT cast(12 as decimal(10,2))
    SELECT cast(12.4 as decimal(10,2))
    SELECT cast(23.44 as decimal(10,2))
    SELECT cast(4.5 as decimal(10,2))

    I would also suggest buying a good reference book on SQL Server.

    I've got 'SQL Server 7 Database Design' by Kevin Hough. I used it to prepare for my MCP but I still use it all the time as a reference.

    I am sure others can recommend other books to.

    HTH,

    Peter

  3. #3
    Join Date
    Mar 2003
    Posts
    16
    hi

    thanks for the help.
    can you guide me for mcp as well

  4. #4
    Join Date
    Mar 2003
    Posts
    16
    Stuck with another problem
    How to get numbers formatted with comma
    in ms-access i use
    select format(123344,"##,##,##.00")

    how to do in sql server

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •