A stored procedure that check if a file exists or not and returns 0 or 1 accordingly if file exis..
Category : SQL Advanced
To make a database backup you need to use a simple code exemplified below. Code: BACKUP DATABASE PRIDEMO TO DISK = ‘C:\MIS\PRIDEMO.BAK’ WITH CHECKSUM BACKUP DATABASE [DATABASE NAME] TO DISK = ‘[DETINATION FULL PATH]’ WIT..
To allow access to this component run the code below to activate. Code: — Activate OLE Access sp_configure ‘show advanced options’, 1 GO RECONFIGURE; GO sp_configure ‘Ole Automation Procedures’, 1 GO RECONFIGURE; GO sp_configure ‘show advanced options’, 1 GO RE..
To use this function you need to give your server user sys.spOACreate permissions. Code: — ============================================= — Author: Bruno Figueiredo — Description: Returns the file information — ============================================= CREATE FUNCTION fn_getfiledetails ( @Filename sysname ) /* How to use: select * from fn_getfiledetails(‘c:\file.ext’) */ RETURNS @filedetails TABLE ( [Path] VARCHAR(100), [ShortPath] VARCHAR(100), [Type] VARCHAR(100), ..
This functionality only works on the latest versions of SQL Server, FOR XML needs the 2014 version and the FOR JSON 2017 version. SELECT Column1, Column2, * FROM Table FOR JSON AUTO SELECT Column1, Column2, * FROM Table FO..
How to get the actual date subtracting 1 day, 1 month and 1 year. You can use this example also to add. ..