Whenever we copy data from SQL Server to excel, we usually face some formatting issues in excel. Specially, if you copy date field from SQL Server to excel. Given below is the script and screen image.
Let me explain the solution step by step.
Step 1 :
Execute the query and paste the data from result set to excel.
Step 2 :
Once you paste the data in excel, just select the date column field, right click on it and select format cells.. from the pop up menu as shown in the picture.
Step 3 :
Once you are in the format cells.. dialogue box, you can select the category as a date and whatever type you want you can select. Given below is the screen image.
Step 4 :
Press OK once you are done and your date column will be formatted as shown in the picture below.
View original post 25 more words