1. I have to fetch number of records created in half an hour interval from 12am to 11:59pm in every 30 minutes.
2. We have make it dynamic to run every 30 minute.
3. This job will give a report for everyday and every 30 mints interval in csv format
To achieve above, I have created below SQL but it's giving error. Can you please help me to fix below error.
DECLARE @FileName VARCHAR(500) = 'E:\FileShare\YourData.csv'
DECLARE @SQLCmd VARCHAR(500) = 'bcp "select count(*) from IB where Notes = ''M_BO'' and CreatedOn between ''2018-11-22 00:00:10.000'' and ''2018-11-22 23:59:10.000''" queryout ' + @FileName + ' -T -c'
EXECUTE master..xp_cmdshell @SQLCmd
SQLState = S0002, NativeError = 208
Error = [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid object name 'IB'.
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC Driver 11 for SQL Server]Unable to resolve column level collations
BCP copy out failed