473,473 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Datetime in sqlserver 2005

raj
Hi,

I have a table which has a column of type datetime,i want to write a
query where i can get only year from my datetime column.
2004-11-16 00:00:00.000 this is the one which i have i required only
2004 on selecting.

Thanks in Advance
Raj
Oct 9 '08 #1
2 3318
On Wed, 8 Oct 2008 19:06:09 -0700 (PDT), raj <2r*******@gmail.com>
wrote:
>I have a table which has a column of type datetime,i want to write a
query where i can get only year from my datetime column.

2004-11-16 00:00:00.000 this is the one which i have i required only
2004 on selecting.
SELECT datepart(year,datetimecolumn)
FROM Whatever

Note that this returns an INT datatype.

Roy Harvey
Beacon Falls, CT
Oct 9 '08 #2
On Oct 9, 3:06*am, raj <2rajes...@gmail.comwrote:
Hi,

I have a table which has a column of type datetime,i want to write a
query where i can get only year from my datetime column.

2004-11-16 00:00:00.000 this is the one which i have i required only
2004 on selecting.

Thanks in Advance
Raj
select year(datetimecolumn) from table
Oct 10 '08 #3

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

Similar topics

3
by: Peter Morris | last post by:
What's the deal with SQLServer 2005 Beta? I've just got a magazine with a free cover disk with VB 2005 beta, and also includes SQLServer 2005. I've installed it, but I can't get it to do...
2
by: C.O.Jones | last post by:
I've previously used version 7 and 2000. I've recently started to learn ASP.net. I've installed Visual Web Developer 2005 Express and this includes SQLServer 2005 in the installation. The task...
0
by: brian | last post by:
Hi there, I'm trying to figure out to to invoke the SqlServer 2005 Import/Export wizard programatically. I.e. Export DatabaseA.TableA to DatabaseB.TableA SqlBulkCopy seems nice but my...
17
by: boa | last post by:
I'm currently planning disk layouts and use for a new version of our database. The current version has all data and indexes in the default filegroup, placed on one big raid-5 array(6 drives) along...
2
by: =?Utf-8?B?SmVmZnJleQ==?= | last post by:
I have some old ASP programs w/ SQLserver 2000 databases. Now I am developing ASP.NET projects using VB 2005 and SQLserver 2005. What are the best procedures to develop and test the ASP.NET...
1
by: Steve | last post by:
Hi; My company just installed MS SQLServer 2005 ( see below the dotted line ). When a user logs into management studio all of the databases on the server are displayed in the right hand...
3
by: Steve | last post by:
Hi; We just migrated to SqlServer 2005. When I import tables from from SqlServer database into another the identity fields get switched off from being identities. How can I prevent that...
6
by: ad | last post by:
How can I detect if my computer have installed SQLServer 2005 or SQLServer 2005 Express with program like c# or VB.NNET?
0
by: selvamariappan | last post by:
Hi all, How to find login name and password for sqlserver 2005 in sql server authentication mode, In my sys i have installed .net and then i have installed sqlserver express, i want...
0
by: Zuby | last post by:
I'm backing up my database through code. It works fine with my clients that have sqlserver 2005. It does not work for the clients that have sqlserver 2008. But I do know it's capable of working...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.