Results 1 to 4 of 4

Thread: DATETIME ใน MS SQL ครับ

  1. #1
    tnruk
    Guest


    DATETIME ใน MS SQL ครับ

    ผม Insert ข้อมูลแบบนี้ครับ
    INSERT INTO telEmp VALUES(1,03-01-2005)
    INSERT INTO telEmp VALUES(2,03/01/2005)
    INSERT INTO telEmp VALUES(3,GETDATE())
    INSERT INTO telEmp VALUES(4,03/01/2548)

    ผลที่ใด้คือ

    1 | 1894-07-08 00:00:00.000
    2 | 1900-01-01 00:00:00.000
    3 | 2005-01-03 04:03:43.477
    4 | 1900-01-01 00:00:00.000

    ทำไม ค่าที่ 1,2 และ 4 ถึงได้ไม่ตรงกับค่าที่ Insert เข้าไปครับ

  2. #2
    Member
    Join Date
    Dec 2004
    Location
    Thailand
    Posts
    30


    Re: DATETIME ใน MS SQL ครับ

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-874">
    </head>

    <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="25"><font size="2">

  3. #3
    Anonymous
    Guest


    Re: DATETIME ใน MS SQL ครับ

    น่าจะใช้

    INSERT INTO telEmp VALUES(1,'03-01-2005')
    INSERT INTO telEmp VALUES(2,'03/01/2005')
    INSERT INTO telEmp VALUES(3,GETDATE())
    INSERT INTO telEmp VALUES(4,'03/01/2548')

    แต่อย่าลืมคับ mysql เก็บข้อมูลเป็น ปี-เดือน-วัน คับต้องใส่ให้ถูกด้วยไม่อย่างนั้นผลออกมาผิดแน่ๆๆคับ

  4. #4



    ฉันคิดว่าถ้า คุณใส่เป็น VALUES(2,เดือน/วัน/ปี) นี่ค่าที่ได้ออกมาไม่ค่อยจะเคลื่อนน่ะค่ะ

Similar Threads

  1. Replies: 1
    Last Post: 14-05-2009, 09:47 PM
  2. Replies: 2
    Last Post: 20-02-2009, 07:05 PM
  3. Replies: 0
    Last Post: 29-01-2008, 05:33 PM
  4. วิธีการแกะรอยหา IP ครับ
    By mastermodradio in forum Hacking, Exploit Articles/Tutorial/Techniques
    Replies: 0
    Last Post: 11-11-2006, 10:13 AM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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