Data Export from MS SQL Server

From SmartHCM Wiki
Revision as of 14:04, 6 June 2017 by Usman (talk | contribs)
Jump to navigation Jump to search
declare @sql varchar(8000)

SELECT @sql =' bcp "select  u.BADGENUMBER EMPLOYEE , CONVERT(VARCHAR, CHECKTIME,110) CHECK_DATE, CONVERT(VARCHAR, CHECKTIME,108) CHECK_TIME,c.CHECKTYPE from [att_db].[dbo].[CHECKINOUT] c, att_db.dbo.USERINFO u where u.USERID=c.USERID AND c.CHECKTIME > DATEADD(MONTH, -1, GETDATE())" queryout D:\TOM-FILE\Attendance-Data.txt -t -c -T'

exec master..xp_cmdshell @sql