Showing posts with label MS SQL Server. Show all posts
Showing posts with label MS SQL Server. Show all posts

Wednesday, March 1, 2023

SQL Date Format

This query will return date and time required fields.

 SELECT ENTRY_DATE ,

  CONVERT(varchar,ENTRY_DATE,100) DateTime,

  CONVERT(varchar,ENTRY_DATE,10) Date ,

  CONVERT(varchar,ENTRY_DATE,108) Time ,

  substring(CONVERT(varchar,ENTRY_DATE,106),1,2) Day,

  substring(CONVERT(varchar,ENTRY_DATE,106),4,3) CMonth,

  substring(CONVERT(varchar,ENTRY_DATE,105),4,2) NMonth,

  substring(CONVERT(varchar,ENTRY_DATE,106),8,4) Year,

  left(right(CONVERT(varchar,ENTRY_DATE,100),7),2) Hours_12,

  substring(CONVERT(varchar,ENTRY_DATE,108),1,2) Hours_24,

  substring(CONVERT(varchar,ENTRY_DATE,108),4,2) Minutes,

  substring(CONVERT(varchar,ENTRY_DATE,108),7,2) Second,

  right(CONVERT(varchar,ENTRY_DATE,100),2) AM_PM from DCR_AUTO_INSERT_LOG

Tuesday, March 30, 2021

SQL Server Service Start Error

Workaround Problem and Solution

 1. Error: 

"The request failed or the service did not respond in a timely fashion.

    Consult the event log or other applicable error logs for details."

Script Level Upgrade for Database ‘master’ Failed Because Upgrade Step

2. Solution for this . Use command to start SQL Service

Whenever script failure issue we are using trace flag 902.

NET START MSSQL$SQLEXPRESS /T902

EXEC sys.sp_configure N'query governor cost limit', N'0'
GO
RECONFIGURE WITH OVERRIDE
GO



When restoring database it is showing below error.

'5 (Access is denied.)' error during restoring database

Check Log On As with Local System.