Skip to main content

Posts

Showing posts from September, 2012

Incorrect SET Options with Filtered Indexes

Rebuild Index|Create Index|DML on a Table with Filtered Index fails with the error: The following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations. [SQLSTATE 42000] (Error 1934).  The step failed. The Operation above might succeed when its through SSMS. But, would fail when the operation is from a SQL Agent Job. This is because, SQL Agent by default, do not have the SET Options enabled (ON). They are OFF. Reason: The following are the SET Options that are needed while operation on a table with a filtered index. Required SET Options for Filtered Indexes The SET options in the Required Value column are required whenever any of the following conditions occur: Create a filtered index. INSERT, UPDATE, DELETE, or MERGE operation modifies the data in a

Sharing a folder through CMD script

Sharing a folder through CMD script: This might possibly be a need while automating a share on a specific condition. Here in, our requirement was to start a share of the folder  for multiple users based on SQL Agent Start. This can be done by the following steps. The approach is to have a .bat file with the command that shares the folder. Later, the bat file can be called from SQL Agent Job Step. The command is: NET SHARE XXX$=E:\MyFolder /GRANT:SQLServer2005SQLAgentUser,FULL /GRANT:SQLServerSQLUser,FULL  /GRANT:"Database Administrators",FULL /GRANT:EVERYONE,READ For Help in Command Prompt: NET SHARE /help Note: Share resource names that end in a $ character do not appear when you browse the local computer from a remote computer. The .bat file can be created by pasting the command above in any text editor and the file can be saved by the extension .bat. The .bat file can be called from the agent job step as Choose the Job Step Type as OperatingSystem (Cmd