Wrox Programmer Forums
|
BOOK: Beginning SQL Server 2005 Programming ISBN: 978-0-7645-8433-6
This is the forum to discuss the Wrox book Beginning SQL Server 2005 Programming by Robert Vieira; ISBN: 9780764584336
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning SQL Server 2005 Programming ISBN: 978-0-7645-8433-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 13th, 2006, 06:31 AM
Registered User
 
Join Date: May 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inserting smalldatetime values using INSERT stmt.

hi...
i have created the table with columns
NAME VARCHAR(30)
DOB SMALLDATETIME

i want to insert a record using the insert statement.
now i tried to insert the record using the following statement

insert into tbDetails values('Jhon', '13/06/1985')
it gave me an error stating
"The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value. The statement has been terminated."
so can u please help me solving this issue.

 
Old June 15th, 2006, 01:38 PM
Authorized User
 
Join Date: Jan 2005
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi, krsihnasamaga.

Although I am just learning all this now, like you, see below:

Use <NameOfDatabase>

Insert into <TableName>
(Name, DOB)
values('Jhon', '1985-06-13')

SELECT * from <TableName>

Cheers,
fskilnik

 
Old September 24th, 2006, 07:52 PM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi krishnasamaga,

An alternative to inserting the date is to use the format dd-mmm-yyyy eg. 25-Sep-2006 then SQL has no problem in knowing which is the day of the month and which is the month.

Regards,
Phillip






Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting values from other tables TheAndruu SQL Language 7 May 27th, 2007 10:47 AM
inserting values sspr SQL Server 2000 2 February 15th, 2006 03:20 PM
inserting values into a database RPG SEARCH ASP.NET 1.0 and 1.1 Basics 3 February 5th, 2005 07:56 PM
INSERT INTO <--inserting data into db abbylee26 Classic ASP Databases 2 March 11th, 2004 05:33 PM
inserting values error - Please help gtmm9 Classic ASP Databases 1 October 6th, 2003 11:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.