Convert text to system date format [duplicate]

EDIT From SQL Server 2012 and later you might use the FORMAT function if you want to force a date into a formatted text: https://msdn.microsoft.com/en-us/library/hh213505.aspx With earlier versions you might use something like this: DECLARE @d DATETIME=GETDATE(); DECLARE @TargetFormat VARCHAR(100)=’DD/MM/YYYY’; SELECT CONVERT(VARCHAR(100),@d, CASE @TargetFormat WHEN ‘MM/DD/YYYY’ THEN 101 WHEN ‘DD/MM/YYYY’ THEN 103 –add all formats … Read more

T-SQL SEQUENCE runs out, no cycle, what happens?

The documentation you mentioned specifies what happens: “[…] throw an exception when its minimum or maximum value is exceeded” Regarding the error message you can find out using a simple Google search: https://www.google.com/search?q=t-sql+error+messages+sequence The fourth link is https://www.sqlshack.com/sequence-objects-in-sql-server/ and there you can find a screenshot of the error, which has the number 11728. Of course, … Read more