473,395 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Select datatype of datetime

Hi,

I have a table containing for ex. a column named MenberDate. The
column has property as datetime. Values look like 13.04.2004
(dd.mm.yyyy) in the table.

Select 'INSERT INTO Menber(Name, MenberDate) VALUES (' Name + ',' ,
cast(menberDate as varchar(12)) + ')' as List from Menber

When I use this sql-statement, the menberDate gives output for ex. Jan
13 2004. It is undesirable.

What I want, is the output of the values look exactly the same
13.04.2004 in the table.

Somebody gives me hints

Thanks in advance

- Loi -
Jul 20 '05 #1
1 3363
On 2 Apr 2004 00:21:28 -0800, Loi Tan Vo wrote:
Select 'INSERT INTO Menber(Name, MenberDate) VALUES (' Name + ',' ,
cast(menberDate as varchar(12)) + ')' as List from Menber

When I use this sql-statement, the menberDate gives output for ex. Jan
13 2004. It is undesirable.

What I want, is the output of the values look exactly the same
13.04.2004 in the table.


Replace "case(menberDate as varchar(12))" with "convert (varchar(12),
menberDate, 104)".

To get the output I think you want, more changes need done to the
select stmt:

Select 'INSERT INTO Menber(Name, MenberDate) VALUES (''' +
Name + ''', ''' +
convert (varchar(12), menberDate, 104) + ''')' as List
from Menber

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Propel Exacto | last post by:
Hey guys, I am using MySQL 4.0.18 and I have a field named "order_datetime" in which I store data in the format 20041001 23:00:00 (for example Oct 1, 2004 11pm) When I do a select statement...
5
by: Greg | last post by:
Well I've done some reading but I think I may be missing something here. I am trying to pass an optional argument to a sproc that will select with a "Where like" clause on an integer data type. ...
10
by: andrewcw | last post by:
I read in a earlier post that I can get the column of a grid to sort by datetime if the column type was set as Date I deserialize my XML and one attribute of the XSD has type as dateTime but upon...
2
by: ven | last post by:
Hello i have two tables in my MS SQL named table1 and table2. In each table i have a column PRICE with my own datatype decimal 14;4 allows nulls.... now i wanna select from one table to second...
1
by: I am Sam | last post by:
I have a select statement that isn’t functioning properly: private void Page_Load(object sender, System.EventArgs e) { myClubNow1=new...
0
by: vijayalakshmi.venkataraman | last post by:
Hello, I have a .NET client that accesses a Java webservice. Let me first say that the client stub I got generated from the wsdl was incomplete and had to make changes to it manually to make it...
3
by: Larry Bertolini | last post by:
For some reason, I recall having read that SQL Server 2005 would support a datatype that represented date, but not time. (This would be useful for storing things like birthday, where you usually...
6
by: ronchese | last post by:
Hi. I'm trying to make a criteria string to use in Select() method of a datatable, searching for a date, but it is apparently not working! In one of my tests, I have a datatable with 1 row and...
11
by: Matt F | last post by:
I'm trying to do something that seems like it should be pretty simple, but haven't found a solution. I am trying to add a datacolumn to a datatable that adds or subtracts a number of days based on...
3
by: Jeff | last post by:
hey ..NET 2.0 I have a datatable which consist of 3 columns (int, date, value). This DataTable have 3 rows, the values of the "date" ("date" column is of datetime datatype) column is:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.