473,385 Members | 1,848 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,385 software developers and data experts.

Need Some SqlServer Help

hi,
I have written the following code to get MonthEndDate,RunDate,MonthStartDate.
It is giving year in MonthStartDate 2005, upto sep07 it is ok.When it come to OCT 07 it has to display monstartdate year as 2006.How can I do this.Please help me

SELECT REPLACE(upper(SUBSTRING(CONVERT(varchar, GETDATE() - DAY(GETDATE()), 113), 1, 11)), ' ', '-')
as MonthEndDate,
'01' + '-' + UPPER(substring(datename(m,getdate()),1,3)) + '-' + cast(datepart(yyyy,getdate())as varchar)
as RunDate,
'01' + '-' + 'OCT' + '-' + cast((datepart(yyyy,getdate())-) as varchar)
as MonthStartDate
May 14 '07 #1
0 915

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Martijn Rutte | last post by:
Hi, On one side, I have a Sybase 12.5 32 bits Server running on AIX 5.1 (maintenance level 3). On the other, I've got W2000 5.00.2195 (SP2) with SQL Server Standard Edition, Product Version...
0
by: williams | last post by:
I am trying to encrypt data in a SQLServer 2000 Cluster using Microsoft EFS. I have successfully encrypted a standalone DB but we are having difficulty with the Cluster. I am only encrypting the...
8
by: Mauricio | last post by:
Hello, Currently we have an ASP.NET 2003 app running, on one function the app calls to a stored procedure to SQLServerONE, that stored procedure creates some TEMP tables with the results of a...
3
by: Edwin Knoppert | last post by:
For near future specifications to place our ASP.NET software on a server not being ours i have to ask you a few rather simple questions. It's for professional use. We would not like to intervene...
1
by: Learner | last post by:
Hi there, I have installed Sql server 2005 developer on my machine which already has a Sql server 2000 installed on. Now i am trying to query the Sqlserver 2005 data(Ex: from Person.Address...
5
by: JSParker1 | last post by:
Summary: Maximum number of records per second that can be inserted into SQLServer 2000. I am trying to insert hundreds (preferably even thousands) of records per second in to SQLServer table...
0
by: UDBDBA | last post by:
Hi: We have a setup which connects a V8.2 32bit db2 instance on AIX to SQLServer 2000 using the unixODBC driver. We have 5 SQLServer "Server mappings" and 4 of them work just fine and can use...
2
by: Jenniflower | last post by:
Hi Gurus, Our system is using SqlServer 2005 on XP.( On my machine,only this application access SQLServer.) The sqlserver memory is configured to 128MB (Min)~512 MB(Max) After our system get...
2
by: XML Beginner | last post by:
I have an XML file that contains values that my application needs, so it knows which database to connect to. It also contains a configuration option so that I can specify which node to return...
1
by: olle | last post by:
hi I have a real problems with comparering date in asp and sqlserver In sqlserver I have a table tblDates with the field dtmDate the field dtmDate in a sqlserver table may contain a date like...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.