Solved

Begining of year value

Posted on 2007-03-28
2
210 Views
Last Modified: 2010-03-19
Hello

In SQL Server how can I get a value that goes back to the begining of the year (any year) I need it to be in integer format ex. 20070101 for this year 20080101 for next year
0
Comment
Question by:charlesbaldo
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 18807515
this year:
select cast(datepart(year, getdate()) as varchar(4)) + '0101'
next year:
select cast( (datepart(year, getdate()) + 1) as varchar(4)) + '0101'
0
 

Author Comment

by:charlesbaldo
ID: 18807571
Perfect Thanks AngelIII  !
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need some help wiht :CAST AS Double 11 47
Sql Permission 6 65
SQL Express connecting form remote error 26 7 49
My Query is not giving correct result. Please help 5 51
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question