sql server has its default date format in da form "yy-mm-dd"
its possible to convert da current date format of sql
server to desired format. Now my question is dat how to get
da previous and comin days date in my desired format??
Answers were Sorted based on User's Feedback
Answer / ritesh parkhi
Yes you can convert it through using
"select
convert(varchar(20),strDate,[1,2,3,4,5,6,101,102,103,104,105,106])"
diffrent diffrent code is present here you can try to use
all like
"select convert(varchar(20),strDate,101)"
where strDate is your date like "12/05/2008" or date from
database.Try it it will solve your problem.
Now second problem to get privious and cming date
"select dateadd(dd,2,strDate)"
i used here dateadd function where dd is used for Day.you
can use MM for month and YYYY fro year also.After that I
gave 2,it is the number to increment in days ,month and
year.and in last i gave strDate
Now i want to get date before 2 days so i will right
"select dateadd(dd,-2,strdate)"
Hopw you will get your answers
Is This Answer Correct ? | 2 Yes | 1 No |
hello mr. ritesh u got write queary but there should be one
modification in place of strdate it will be getdate()
funtion like this:
select datedd(dd,-2,getdate())
from this queary u will get date before 2 days due to -2
ok
so swapan try this query u will get ur answer
Is This Answer Correct ? | 0 Yes | 0 No |
could you please reply for these question: 1.About Use Apply? 2.Avoid cursors - When we have a situation that we can not avoid the use of cursor than what is the alternate solution? is there anything we can use instead of cursor to perform the desired task? which optiomize the peroformance too. 3.What is computed columns? Thanks in advance. Regards, Rupesh
Please tell me some knowledge about Clustering and how to add clustering?
How to add more data to the testing table in ms sql server?
What new changes are being made in SQL Server?
What is raid, and how it can influence database performance?
What is sql language?
Explain time data type in sal server 2008?
why would you use sql agent? : Sql server database administration
What are statistics, under what circumstances they go out of date, how do you update them?
what is victor class
What is Online Index Rebuild Operation?
What are ddl (data definition language) statements for tables in ms sql server?