Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Re: insert only date
"JIM.H." <JIMH@discussions.microsoft.com> wrote in message
news:27606F13-199E-45F1-9E12- B1232845A907@microso
ft.com...
> In a stored procedure;
>
> INSERT INTO myTable(myDate) VALUES (@myDate)
>
> This inserts data and time, is there any way I can only insert date
> portion
> of DateTime

Is "myDate" field of datetime type or of varchar type?

If datetime, all you can do is to "truncate" the date to the midnight:

2005-07-27 21:17:41.123 -> 2005-07-27 00:00:00.000

and you do this so:

convert(datetime,  substring(convert(va
rchar, @myDate, 120), 1, 10), 120)

if it is varchar then

 substring(convert(va
rchar, @myDate, 120), 1, 10)

Cheers,
Wojtek



Report this thread to moderator Post Follow-up to this message
Old Post
Wojtek Garwol
07-28-05 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 12:30 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006