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 |
Tell me about joins in database system and explain each in detail.
0 Answers Axtria, ITC Indian Tobacco Company,
how to change column into row in sql
how to take backup bcp out for a column in table in sql server?
Can we use where clause in union?
Some queries related to SQL
What is index, cluster index and nonclustered index?
How to delete particular value in the column of a table.Is it possible or not?if possible give it as in query.
What is partition in sql server?
What is policy based management (pbm)? : sql server database administration
what is replication? where do u use Go Keyword?
what is IDE,DMV in sql server?
How to write a script for upate the data in prod , i have 50000 row are there
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)