<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!-- generator="Joomla! 1.5 - Open Source Content Management" --><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en-gb">
	<title type="text">Retail Systems Technical Advice: Dave's Blog</title>
	<subtitle type="text">Retail POS, Radiant POS, and CounterPoint POS. Based in Seattle Washington for over 30 years.  Certified Supoort, 24hr support, onsite support.</subtitle>
	<link rel="alternate" type="text/html" href="http://www.ccscentral.com" />
	<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog</id>
	<updated>2012-02-11T08:26:49Z</updated>
	<generator uri="http://joomla.org" version="1.5">Joomla! 1.5 - Open Source Content Management</generator>

	<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/RetailSystemsTechnicalAdviceDavesBlog" /><feedburner:info uri="retailsystemstechnicaladvicedavesblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
		<title>Scheduling Jobs in SQL</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/ab9lG2sV-IY/1218-scheduling-jobs-in-sql" />
		<published>2012-02-01T00:08:35Z</published>
		<updated>2012-02-01T00:08:35Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1218-scheduling-jobs-in-sql</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Scheduling SQL Jobs&lt;/p&gt;
&lt;p class="std"&gt;Scheduling SQL jobs can be very useful, both for repeating jobs, and for long-running jobs that execute during off hours.&lt;br /&gt;
&lt;br /&gt;
While SQL jobs can be run using the command OSQL, or the Windows scheduler, there are some advantages&amp;nbsp;to using the SQL Server Agent, and&amp;nbsp;its built in job scheduler.&lt;br /&gt;
&lt;br /&gt;
One of the biggest advantages of using the SQL Server Agent, is that jobs can consist of several steps.&amp;nbsp; When one step completes, the job can go on to the next step, or end, depending on the outcome of the step that just finished.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
For example, you could build a job that checks for new orders.&amp;nbsp; If any new orders are found, you could proceed to a second step, and process the new orders.&amp;nbsp; If none are found, you could end the job.&amp;nbsp; Jobs can also proceed if a step fails, and end if it succeeds.&lt;br /&gt;
&lt;br /&gt;
Maintenance tasks, such as backing up your databases, rebuilding indexes, are prime candidates for this type of scheduling.&amp;nbsp; A single job can be created, that goes through all of the maintenance tasks.&amp;nbsp; This job can then be scheduled to run periodically, during off hours, reducing the load impacting your users.&lt;br /&gt;
&lt;br /&gt;
Another good candidate for this, would be a major reorganization of your database.&amp;nbsp; Adding columns to large tables, and populating them with data, can put a load on your server.&amp;nbsp; In this case, the job would be setup, and scheduled to run one time during off hours.&lt;br /&gt;
&lt;br /&gt;
Any SQL commands can be run, as long as there is no user intervention needed.&amp;nbsp; So, take a look through your SQL scripts, especially the ones that you need to run periodically, and consider scheduling them to run automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="mailto:support@ccscentral.com?subject=Creating%20SQL%20Jobs"&gt;Contact CCS Retail Systems&lt;/a&gt; if you need help creating you SQL scripts and jobs.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Scheduling SQL Jobs&lt;/p&gt;
&lt;p class="std"&gt;Scheduling SQL jobs can be very useful, both for repeating jobs, and for long-running jobs that execute during off hours.&lt;br /&gt;
&lt;br /&gt;
While SQL jobs can be run using the command OSQL, or the Windows scheduler, there are some advantages&amp;nbsp;to using the SQL Server Agent, and&amp;nbsp;its built in job scheduler.&lt;br /&gt;
&lt;br /&gt;
One of the biggest advantages of using the SQL Server Agent, is that jobs can consist of several steps.&amp;nbsp; When one step completes, the job can go on to the next step, or end, depending on the outcome of the step that just finished.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
For example, you could build a job that checks for new orders.&amp;nbsp; If any new orders are found, you could proceed to a second step, and process the new orders.&amp;nbsp; If none are found, you could end the job.&amp;nbsp; Jobs can also proceed if a step fails, and end if it succeeds.&lt;br /&gt;
&lt;br /&gt;
Maintenance tasks, such as backing up your databases, rebuilding indexes, are prime candidates for this type of scheduling.&amp;nbsp; A single job can be created, that goes through all of the maintenance tasks.&amp;nbsp; This job can then be scheduled to run periodically, during off hours, reducing the load impacting your users.&lt;br /&gt;
&lt;br /&gt;
Another good candidate for this, would be a major reorganization of your database.&amp;nbsp; Adding columns to large tables, and populating them with data, can put a load on your server.&amp;nbsp; In this case, the job would be setup, and scheduled to run one time during off hours.&lt;br /&gt;
&lt;br /&gt;
Any SQL commands can be run, as long as there is no user intervention needed.&amp;nbsp; So, take a look through your SQL scripts, especially the ones that you need to run periodically, and consider scheduling them to run automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="mailto:support@ccscentral.com?subject=Creating%20SQL%20Jobs"&gt;Contact CCS Retail Systems&lt;/a&gt; if you need help creating you SQL scripts and jobs.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/ab9lG2sV-IY" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1218-scheduling-jobs-in-sql</feedburner:origLink></entry>
	<entry>
		<title>Scheduling tasks on Linux</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/bYLMJzSt120/1203-scheduling-tasks-on-linux" />
		<published>2012-01-18T23:15:11Z</published>
		<updated>2012-01-18T23:15:11Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1203-scheduling-tasks-on-linux</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Using Linux Cron&lt;/p&gt;
&lt;p class="std"&gt;There are many tasks that are done periodically on a Linux system.&amp;nbsp; System cleanup, or monitoring, are common ones, as is backing up your system. &lt;br /&gt;
&lt;br /&gt;
These are all candidates for being scheduled to occur automatically. &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
The facility to schedule jobs on your Linux system, is &lt;em&gt;cron&lt;/em&gt;.&amp;nbsp; First, make sure that cron is installed on your system, and running automatically.&amp;nbsp; Just how this is done, varies depending on the version and dialect&amp;nbsp;of Linux that you are running.&lt;br /&gt;
&lt;br /&gt;
Once cron is installed and running, it is time to schedule some jobs.&amp;nbsp; This is done with the &amp;quot;crontab -e&amp;quot; command.&amp;nbsp; This command takes you into the an editor (normally vi or vim) for your cron tables, which is what cron uses to determine what is to be run and the run schedule. When you exit the editor, the running cron is updated with your changes.&amp;nbsp; It is best to use the crontab editor because, If you edit the cron tables directly, it may not pick up your changes until cron is restarted, typically the next time you reboot.&lt;br /&gt;
&lt;br /&gt;
The editor that is used by the crontab command, is the one identified by your EDITOR environment variable.&amp;nbsp; You should be familiar with it before you try to change the cron entries.&amp;nbsp; Assuming it is vi or vim, you can read the man pages for this utility with &amp;quot;man vim&amp;quot;.&amp;nbsp; For a vim tutorial the&amp;nbsp;&amp;quot;vimtutor&amp;quot; command can be used as well.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Each line in the cron table, is a command to be run at a specific time.&amp;nbsp; The exception to this is lines beginning with the pound sign (#), which are comments.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;There are basically six fields, separated by spaces.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;The first five are define when to run and are the minute, hour, day of the month, month, and day of the week.&amp;nbsp; Any of these may be &amp;quot;*&amp;quot;, which means &amp;quot;all&amp;quot;.&amp;nbsp; So, a line beginning with &amp;quot;* * * * *&amp;quot; would run each minute, hour, day, etc.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;To run at specific times, these fields would have numbers in them.&amp;nbsp; This can be a single number, a list of numbers separated by a comma, or a range.&amp;nbsp; A range is identified by a dash (-).&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="std"&gt;To run at the top of the hour, you would use &amp;quot;0&amp;quot; for the minute field. To run at 15 and 45 minutes after the hour, you would use &amp;quot;15,45&amp;quot;, and to run each of the first five minutes of the hour, &amp;quot;1-5&amp;quot;.&amp;nbsp; These numbers would be put in without the quotes.&lt;br /&gt;
&lt;br /&gt;
The range for minutes is 0-59, for hours is 0-23, day of the month 1-31, month 1-12, and day of the week 0-6 (with 0 being Sunday).&lt;br /&gt;
&lt;br /&gt;
So, to run a task at 4:15 PM, the first and the 15th of a month, the command would be &amp;quot;15 16 1,15 * * command&amp;quot;.&amp;nbsp; At noon every Friday would be &amp;quot;0 12 * * 5 command&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The command field is everything following the day of the week entry.&amp;nbsp; This can be any executable Linux command.&amp;nbsp; Typically, it is a shell script, containing the commands to be executed.&amp;nbsp; If it is a shell script, make sure that the permissions are set with the execute (x).&lt;br /&gt;
&lt;br /&gt;
Any output will be sent via email to the user for that cron table.&amp;nbsp; I usually prefer to redirect the output to a log file, instead.&amp;nbsp; First, I redirect any errors to the standard output, using 2&amp;gt;&amp;amp;1.&amp;nbsp; Then, I redirect and append the output to a log file, using double greater than (&amp;gt;&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Put it all together, and you have an entry like:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;15 16 1,15 * * command 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt; /var/log/command.log&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
This runs the command &amp;quot;command&amp;quot;, on the first and fifteenth of every month.&amp;nbsp; Errors are redirected to standard output, and standard output is appended to the file &amp;quot;/var/log/command.log&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This is a quick introduction to cron.&amp;nbsp; If you need help creating cron scripts and scheduling them with crontab &lt;a href="mailto:support@ccscentral.com?subject=Using%20Cron%20Scripts"&gt;contact us&lt;/a&gt; at CCS Retail Systems.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;br /&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Using Linux Cron&lt;/p&gt;
&lt;p class="std"&gt;There are many tasks that are done periodically on a Linux system.&amp;nbsp; System cleanup, or monitoring, are common ones, as is backing up your system. &lt;br /&gt;
&lt;br /&gt;
These are all candidates for being scheduled to occur automatically. &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
The facility to schedule jobs on your Linux system, is &lt;em&gt;cron&lt;/em&gt;.&amp;nbsp; First, make sure that cron is installed on your system, and running automatically.&amp;nbsp; Just how this is done, varies depending on the version and dialect&amp;nbsp;of Linux that you are running.&lt;br /&gt;
&lt;br /&gt;
Once cron is installed and running, it is time to schedule some jobs.&amp;nbsp; This is done with the &amp;quot;crontab -e&amp;quot; command.&amp;nbsp; This command takes you into the an editor (normally vi or vim) for your cron tables, which is what cron uses to determine what is to be run and the run schedule. When you exit the editor, the running cron is updated with your changes.&amp;nbsp; It is best to use the crontab editor because, If you edit the cron tables directly, it may not pick up your changes until cron is restarted, typically the next time you reboot.&lt;br /&gt;
&lt;br /&gt;
The editor that is used by the crontab command, is the one identified by your EDITOR environment variable.&amp;nbsp; You should be familiar with it before you try to change the cron entries.&amp;nbsp; Assuming it is vi or vim, you can read the man pages for this utility with &amp;quot;man vim&amp;quot;.&amp;nbsp; For a vim tutorial the&amp;nbsp;&amp;quot;vimtutor&amp;quot; command can be used as well.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Each line in the cron table, is a command to be run at a specific time.&amp;nbsp; The exception to this is lines beginning with the pound sign (#), which are comments.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;There are basically six fields, separated by spaces.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;The first five are define when to run and are the minute, hour, day of the month, month, and day of the week.&amp;nbsp; Any of these may be &amp;quot;*&amp;quot;, which means &amp;quot;all&amp;quot;.&amp;nbsp; So, a line beginning with &amp;quot;* * * * *&amp;quot; would run each minute, hour, day, etc.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;To run at specific times, these fields would have numbers in them.&amp;nbsp; This can be a single number, a list of numbers separated by a comma, or a range.&amp;nbsp; A range is identified by a dash (-).&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="std"&gt;To run at the top of the hour, you would use &amp;quot;0&amp;quot; for the minute field. To run at 15 and 45 minutes after the hour, you would use &amp;quot;15,45&amp;quot;, and to run each of the first five minutes of the hour, &amp;quot;1-5&amp;quot;.&amp;nbsp; These numbers would be put in without the quotes.&lt;br /&gt;
&lt;br /&gt;
The range for minutes is 0-59, for hours is 0-23, day of the month 1-31, month 1-12, and day of the week 0-6 (with 0 being Sunday).&lt;br /&gt;
&lt;br /&gt;
So, to run a task at 4:15 PM, the first and the 15th of a month, the command would be &amp;quot;15 16 1,15 * * command&amp;quot;.&amp;nbsp; At noon every Friday would be &amp;quot;0 12 * * 5 command&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The command field is everything following the day of the week entry.&amp;nbsp; This can be any executable Linux command.&amp;nbsp; Typically, it is a shell script, containing the commands to be executed.&amp;nbsp; If it is a shell script, make sure that the permissions are set with the execute (x).&lt;br /&gt;
&lt;br /&gt;
Any output will be sent via email to the user for that cron table.&amp;nbsp; I usually prefer to redirect the output to a log file, instead.&amp;nbsp; First, I redirect any errors to the standard output, using 2&amp;gt;&amp;amp;1.&amp;nbsp; Then, I redirect and append the output to a log file, using double greater than (&amp;gt;&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Put it all together, and you have an entry like:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;15 16 1,15 * * command 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt; /var/log/command.log&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
This runs the command &amp;quot;command&amp;quot;, on the first and fifteenth of every month.&amp;nbsp; Errors are redirected to standard output, and standard output is appended to the file &amp;quot;/var/log/command.log&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This is a quick introduction to cron.&amp;nbsp; If you need help creating cron scripts and scheduling them with crontab &lt;a href="mailto:support@ccscentral.com?subject=Using%20Cron%20Scripts"&gt;contact us&lt;/a&gt; at CCS Retail Systems.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/bYLMJzSt120" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1203-scheduling-tasks-on-linux</feedburner:origLink></entry>
	<entry>
		<title>Using OSQL to run scripts</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/6uHmnxT2v4k/1202-using-osql-to-run-scripts" />
		<published>2012-01-18T22:19:11Z</published>
		<updated>2012-01-18T22:19:11Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1202-using-osql-to-run-scripts</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Using the Windows oSQL Command&lt;/p&gt;
&lt;p class="std"&gt;Using the Windows OSQL command instead of SQL Management Studio can have it's advantages.&amp;nbsp; I use OSQL, from a batch file, when I have a script that I want to run against multiple databases, or different servers.&lt;br /&gt;
&lt;br /&gt;
First, to use OSQL, it has to be installed on your computer.&amp;nbsp; If you have SQL Server, or Express, on your computer, then OSQL should have been installed by default.&amp;nbsp; If not, then install the SQL Server Client Tools, from the SQL CD.&amp;nbsp; &lt;u&gt;Do not install the server, just the tools.&lt;br /&gt;
&lt;/u&gt;&lt;br /&gt;
OSQL has several options that can be selected.&amp;nbsp; The ones I use the most are Server (-S server), database (-d database), username (-U username), password (-P password), input file (-i inputfile), and output file (-o outputfile). &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
A typical batch file would look something like &amp;quot;osql -S %1 -d %2 -U %3 -P %4 -i inputfile.sql -o outputfile.txt&amp;quot;.&amp;nbsp; If this batch file were named, for example, batchfile.bat, it would then be called with:&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;batchfile.bat servername databasename username password,&amp;nbsp; &lt;/strong&gt;where %1 is servername, %2 is databasename, %3 is username, %4 is password.&amp;nbsp;&lt;strong&gt;&amp;nbsp; &lt;/strong&gt;Inputfile.sql and output.txt are hard coded in this example.&lt;br /&gt;
&lt;br /&gt;
The servername, databasename, username, and password, would be the actual values that I wanted to pass to the OSQL command line.&amp;nbsp; The batch file would then run OSQL, using those parameters in order, and running the inputfile.sql (from the -i option), and sending the output to outputfile.txt (from the -o option).&amp;nbsp; You will need help from your administrator to get the security information you need.&lt;br /&gt;
&lt;br /&gt;
A batch file like this, can be used in different ways.&amp;nbsp; It can be run from a command prompt when needed, or it can be scheduled via the Windows Task Scheduler.&amp;nbsp; For example, you could make scheduled entries to run the same script on several different servers.&amp;nbsp; One schedule entry per server, with the appropriate options being passed to it in&amp;nbsp;a command line.&lt;br /&gt;
&lt;br /&gt;
This is just a quick introduction to oSQL.&amp;nbsp; If you are not current on the syntax of the SQL language, try the tutorials at the &lt;a target="_blank" href="http://www.w3schools.com"&gt;w3schools.com&lt;/a&gt; site.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
We write SQL scripts for our customers on a daily basis.&amp;nbsp; &lt;a href="mailto:support@ccscentral.com?subject=SQL%20Scripting%20Help"&gt;Contact us&lt;/a&gt; at CCS Retail Systems if you need help.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Using the Windows oSQL Command&lt;/p&gt;
&lt;p class="std"&gt;Using the Windows OSQL command instead of SQL Management Studio can have it's advantages.&amp;nbsp; I use OSQL, from a batch file, when I have a script that I want to run against multiple databases, or different servers.&lt;br /&gt;
&lt;br /&gt;
First, to use OSQL, it has to be installed on your computer.&amp;nbsp; If you have SQL Server, or Express, on your computer, then OSQL should have been installed by default.&amp;nbsp; If not, then install the SQL Server Client Tools, from the SQL CD.&amp;nbsp; &lt;u&gt;Do not install the server, just the tools.&lt;br /&gt;
&lt;/u&gt;&lt;br /&gt;
OSQL has several options that can be selected.&amp;nbsp; The ones I use the most are Server (-S server), database (-d database), username (-U username), password (-P password), input file (-i inputfile), and output file (-o outputfile). &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
A typical batch file would look something like &amp;quot;osql -S %1 -d %2 -U %3 -P %4 -i inputfile.sql -o outputfile.txt&amp;quot;.&amp;nbsp; If this batch file were named, for example, batchfile.bat, it would then be called with:&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;batchfile.bat servername databasename username password,&amp;nbsp; &lt;/strong&gt;where %1 is servername, %2 is databasename, %3 is username, %4 is password.&amp;nbsp;&lt;strong&gt;&amp;nbsp; &lt;/strong&gt;Inputfile.sql and output.txt are hard coded in this example.&lt;br /&gt;
&lt;br /&gt;
The servername, databasename, username, and password, would be the actual values that I wanted to pass to the OSQL command line.&amp;nbsp; The batch file would then run OSQL, using those parameters in order, and running the inputfile.sql (from the -i option), and sending the output to outputfile.txt (from the -o option).&amp;nbsp; You will need help from your administrator to get the security information you need.&lt;br /&gt;
&lt;br /&gt;
A batch file like this, can be used in different ways.&amp;nbsp; It can be run from a command prompt when needed, or it can be scheduled via the Windows Task Scheduler.&amp;nbsp; For example, you could make scheduled entries to run the same script on several different servers.&amp;nbsp; One schedule entry per server, with the appropriate options being passed to it in&amp;nbsp;a command line.&lt;br /&gt;
&lt;br /&gt;
This is just a quick introduction to oSQL.&amp;nbsp; If you are not current on the syntax of the SQL language, try the tutorials at the &lt;a target="_blank" href="http://www.w3schools.com"&gt;w3schools.com&lt;/a&gt; site.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
We write SQL scripts for our customers on a daily basis.&amp;nbsp; &lt;a href="mailto:support@ccscentral.com?subject=SQL%20Scripting%20Help"&gt;Contact us&lt;/a&gt; at CCS Retail Systems if you need help.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/6uHmnxT2v4k" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1202-using-osql-to-run-scripts</feedburner:origLink></entry>
	<entry>
		<title>Running SQL scripts</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/VXJcOOatWPw/1201-running-sql-scripts" />
		<published>2012-01-18T22:18:20Z</published>
		<updated>2012-01-18T22:18:20Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1201-running-sql-scripts</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Creating a SQL Script&lt;/p&gt;
&lt;p class="std"&gt;There are several methods that can be used to run SQL scripts.&amp;nbsp; Which method is best, depends on the purpose of the script.&lt;br /&gt;
&lt;br /&gt;
If the script is meant to be run one time, or on rare occasion with no set pattern, then running the script directly makes the most sense.&amp;nbsp; It can be run through the SQL Management Studio Express, or from the Windows command line, if OSQL is installed.&lt;br /&gt;
&lt;br /&gt;
The easiest way to write your script, is using the SQL Management Studio.&amp;nbsp; Open Management Studio, and log into the database server.&amp;nbsp; Expand the databases, and right click on the database that you want to run the script on, and select New Query.&amp;nbsp; The right hand side will open a new window for you to write your query.&lt;br /&gt;
&lt;br /&gt;
When writing queries in the Management Studio, as you type, table names and field names will show in a drop down list, based on what you are typing.&amp;nbsp; You can select from these, and save yourself some keystrokes.&lt;br /&gt;
&lt;br /&gt;
Once you have finished your script, and tested it (by using the Execute button in Management Studio Toolbar), save it with a &amp;quot;.sql&amp;quot; extension.&amp;nbsp; By using this extension, if you double click on the script in Windows, it will automatically launch the SQL Management Studio, and load your script.&amp;nbsp; Once you log in to the database server, your script is then ready to be run, by hitting the Execute button.&lt;br /&gt;
&lt;br /&gt;
This is simpler than using OSQL to run your scripts.&amp;nbsp; However, there are some advantages to using OSQL, which I will look at in my next blog.&lt;br /&gt;
&lt;br /&gt;
If you are not current on the SQL language syntax, try the w3schools.com site:&amp;nbsp;&lt;a target="_blank" href="http://www.w3schools.com/sql/default.asp"&gt;http://www.w3schools.com/sql/default.asp&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
NOTE:&amp;nbsp; If you are creating SQL scripts you should be the Administrator or creating scripts with the Administrator approval.&amp;nbsp; Your SQL Database Server (Engine) should be password protected.&amp;nbsp; You will need this information to get logged in.&lt;br /&gt;
&lt;br /&gt;
We write SQL scripts for our customers almost on a daily basis.&amp;nbsp; If you need help &lt;a href="mailto:support@ccscentral.com?subject=SQL%20Scripting%20Help"&gt;contact us&lt;/a&gt;&amp;nbsp;at CCS Retail Systems.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;br /&gt;
&lt;br /&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Creating a SQL Script&lt;/p&gt;
&lt;p class="std"&gt;There are several methods that can be used to run SQL scripts.&amp;nbsp; Which method is best, depends on the purpose of the script.&lt;br /&gt;
&lt;br /&gt;
If the script is meant to be run one time, or on rare occasion with no set pattern, then running the script directly makes the most sense.&amp;nbsp; It can be run through the SQL Management Studio Express, or from the Windows command line, if OSQL is installed.&lt;br /&gt;
&lt;br /&gt;
The easiest way to write your script, is using the SQL Management Studio.&amp;nbsp; Open Management Studio, and log into the database server.&amp;nbsp; Expand the databases, and right click on the database that you want to run the script on, and select New Query.&amp;nbsp; The right hand side will open a new window for you to write your query.&lt;br /&gt;
&lt;br /&gt;
When writing queries in the Management Studio, as you type, table names and field names will show in a drop down list, based on what you are typing.&amp;nbsp; You can select from these, and save yourself some keystrokes.&lt;br /&gt;
&lt;br /&gt;
Once you have finished your script, and tested it (by using the Execute button in Management Studio Toolbar), save it with a &amp;quot;.sql&amp;quot; extension.&amp;nbsp; By using this extension, if you double click on the script in Windows, it will automatically launch the SQL Management Studio, and load your script.&amp;nbsp; Once you log in to the database server, your script is then ready to be run, by hitting the Execute button.&lt;br /&gt;
&lt;br /&gt;
This is simpler than using OSQL to run your scripts.&amp;nbsp; However, there are some advantages to using OSQL, which I will look at in my next blog.&lt;br /&gt;
&lt;br /&gt;
If you are not current on the SQL language syntax, try the w3schools.com site:&amp;nbsp;&lt;a target="_blank" href="http://www.w3schools.com/sql/default.asp"&gt;http://www.w3schools.com/sql/default.asp&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
NOTE:&amp;nbsp; If you are creating SQL scripts you should be the Administrator or creating scripts with the Administrator approval.&amp;nbsp; Your SQL Database Server (Engine) should be password protected.&amp;nbsp; You will need this information to get logged in.&lt;br /&gt;
&lt;br /&gt;
We write SQL scripts for our customers almost on a daily basis.&amp;nbsp; If you need help &lt;a href="mailto:support@ccscentral.com?subject=SQL%20Scripting%20Help"&gt;contact us&lt;/a&gt;&amp;nbsp;at CCS Retail Systems.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/VXJcOOatWPw" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1201-running-sql-scripts</feedburner:origLink></entry>
	<entry>
		<title>SQL Maintenance</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/S1YeRNQKhzo/1187-sql-maintenance" />
		<published>2011-12-31T02:45:15Z</published>
		<updated>2011-12-31T02:45:15Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1187-sql-maintenance</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;SQL Maintenance&lt;/p&gt;
&lt;p class="std"&gt;If you have one of the full versions of SQL server, the SQL Management Studio has a section called &amp;quot;Maintenance Plans&amp;quot; that makes scheduling tasks like rebuilding indexes and updating statistics very easy.&lt;br /&gt;
&lt;br /&gt;
From the SQL Management Studio, expand the &amp;quot;Management&amp;quot; section, and you will see &amp;quot;Maintenance Plans&amp;quot; under it.&amp;nbsp; Using the right mouse button, click on &amp;quot;Maintenance Plans&amp;quot;, and you will get several options.&amp;nbsp; The simplest, is to choose &amp;quot;Maintenance Plan Wizard&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The Wizard will step you through everything to build, and schedule your plan.&amp;nbsp; To setup a rebuild indexes and update statistics, for example, you would click &amp;quot;Next&amp;quot; until you get to the plan properties page.&lt;br /&gt;
&lt;br /&gt;
On the plan properties, name your maintenance plan, for example &amp;quot;Re-index&amp;quot;.&amp;nbsp; It is useful to put a comment in for later reference, such as &amp;quot;Rebuild Indexes and Update Statistics&amp;quot;.&amp;nbsp; Leave the option on &amp;quot;Single schedule&amp;quot;, and click the &amp;quot;Change&amp;quot; button to schedule the plan.&amp;nbsp; Set the plan to &amp;quot;Recurring&amp;quot; and make sure it is enabled.&amp;nbsp; Set the schedule fields for what best suits your needs.&amp;nbsp; Weekly or daily would be appropriate in this case, depending on how active your database is.&amp;nbsp; See my blog on &amp;quot;SQL Performance&amp;quot; for a discussion on this.&amp;nbsp; Select :OK&amp;quot; when you have the schedule set, and then &amp;quot;Next&amp;quot; to go to the task selection.&lt;br /&gt;
&lt;br /&gt;
For the tasks, select &amp;quot;Rebuild Indexes&amp;quot; and &amp;quot;Update Statistics&amp;quot;.&amp;nbsp; The next page allows you to define the order that they process in.&amp;nbsp; Indexes should be rebuilt before the statistics are updated, so the default order is fine.&amp;nbsp; Next, will take you to the properties for each of the tasks.&amp;nbsp; Select &amp;quot;All&amp;quot; for the databases, unless you have a reason to only do specific ones.&amp;nbsp; The default values for the rest of the options should be okay. &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Going forward from there, you have the option to save results to a file, or email them.&amp;nbsp; Saving results is always a good idea.&amp;nbsp; Doing another &amp;quot;Next&amp;quot; brings you to the confirmation page, where doing a &amp;quot;Finish&amp;quot; will do the actual building of the maintenance plan, and scheduling it.&lt;br /&gt;
&lt;br /&gt;
That's all it takes to setup and schedule most SQL maintenance tasks.&amp;nbsp; Other things, such as shrinking the database, or checking the integrity can be setup the same way.&amp;nbsp; Other SQL tasks that you do frequently can also be scheduled outside of the Wizard.&amp;nbsp; I will take a look at doing those in a future blog.&lt;br /&gt;
&lt;br /&gt;
Dave.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;SQL Maintenance&lt;/p&gt;
&lt;p class="std"&gt;If you have one of the full versions of SQL server, the SQL Management Studio has a section called &amp;quot;Maintenance Plans&amp;quot; that makes scheduling tasks like rebuilding indexes and updating statistics very easy.&lt;br /&gt;
&lt;br /&gt;
From the SQL Management Studio, expand the &amp;quot;Management&amp;quot; section, and you will see &amp;quot;Maintenance Plans&amp;quot; under it.&amp;nbsp; Using the right mouse button, click on &amp;quot;Maintenance Plans&amp;quot;, and you will get several options.&amp;nbsp; The simplest, is to choose &amp;quot;Maintenance Plan Wizard&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The Wizard will step you through everything to build, and schedule your plan.&amp;nbsp; To setup a rebuild indexes and update statistics, for example, you would click &amp;quot;Next&amp;quot; until you get to the plan properties page.&lt;br /&gt;
&lt;br /&gt;
On the plan properties, name your maintenance plan, for example &amp;quot;Re-index&amp;quot;.&amp;nbsp; It is useful to put a comment in for later reference, such as &amp;quot;Rebuild Indexes and Update Statistics&amp;quot;.&amp;nbsp; Leave the option on &amp;quot;Single schedule&amp;quot;, and click the &amp;quot;Change&amp;quot; button to schedule the plan.&amp;nbsp; Set the plan to &amp;quot;Recurring&amp;quot; and make sure it is enabled.&amp;nbsp; Set the schedule fields for what best suits your needs.&amp;nbsp; Weekly or daily would be appropriate in this case, depending on how active your database is.&amp;nbsp; See my blog on &amp;quot;SQL Performance&amp;quot; for a discussion on this.&amp;nbsp; Select :OK&amp;quot; when you have the schedule set, and then &amp;quot;Next&amp;quot; to go to the task selection.&lt;br /&gt;
&lt;br /&gt;
For the tasks, select &amp;quot;Rebuild Indexes&amp;quot; and &amp;quot;Update Statistics&amp;quot;.&amp;nbsp; The next page allows you to define the order that they process in.&amp;nbsp; Indexes should be rebuilt before the statistics are updated, so the default order is fine.&amp;nbsp; Next, will take you to the properties for each of the tasks.&amp;nbsp; Select &amp;quot;All&amp;quot; for the databases, unless you have a reason to only do specific ones.&amp;nbsp; The default values for the rest of the options should be okay. &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Going forward from there, you have the option to save results to a file, or email them.&amp;nbsp; Saving results is always a good idea.&amp;nbsp; Doing another &amp;quot;Next&amp;quot; brings you to the confirmation page, where doing a &amp;quot;Finish&amp;quot; will do the actual building of the maintenance plan, and scheduling it.&lt;br /&gt;
&lt;br /&gt;
That's all it takes to setup and schedule most SQL maintenance tasks.&amp;nbsp; Other things, such as shrinking the database, or checking the integrity can be setup the same way.&amp;nbsp; Other SQL tasks that you do frequently can also be scheduled outside of the Wizard.&amp;nbsp; I will take a look at doing those in a future blog.&lt;br /&gt;
&lt;br /&gt;
Dave.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/S1YeRNQKhzo" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1187-sql-maintenance</feedburner:origLink></entry>
	<entry>
		<title>When your system freezes up</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/bkHtteC4NPs/1186-when-your-system-freezes-up" />
		<published>2011-12-31T02:44:38Z</published>
		<updated>2011-12-31T02:44:38Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1186-when-your-system-freezes-up</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Avoiding File Corruption&lt;/p&gt;
&lt;p class="std"&gt;No matter how well you maintain your system, there comes the time when it freezes up.&amp;nbsp; When that happens, you really have no choice other than to do a hard reset, by turning the power off, and back on.&amp;nbsp; Since there is an inherent risk that this will result in some file corruption, it should be avoided if at all possible.&amp;nbsp; Still, sometimes it is necessary.&lt;br /&gt;
&lt;br /&gt;
There are many times, however, when your system is not truly frozen, but is overloaded instead.&amp;nbsp; This is more common in a network environment, when users are running software that is server based.&amp;nbsp; In this case, it may appear to be frozen, as users get no response at their workstations.&amp;nbsp; However, what may really be happening, is that the server has become so busy, that it does not have time to respond to the requests from the workstation.&amp;nbsp; The appearance to the users is the same, but true cause is different.&lt;br /&gt;
&lt;br /&gt;
The difference is important, because if it is a matter of server overload, many times the process causing the overload can found and killed.&amp;nbsp; If this can be done, the risk of corrupting your data files is much less than if the system is simply powered down.&amp;nbsp; &lt;u&gt;The reason for this is that when a process is killed, in most cases, it closes the files that it has open as it goes down.&amp;nbsp; If the power is simply shut off, this does not occur.&lt;br /&gt;
&lt;/u&gt;&lt;br /&gt;
Check your system for any indications of activity, to determine if it is overloaded as opposed to being frozen.&amp;nbsp; In most cases, an overloaded system will have high disk usage.&amp;nbsp; You may be able to hear the disk drive working, or the disk activity light on the computer may be blinking very fast, or even on solid.&amp;nbsp; If that is the case, then you have a good chance of being able to get on and kill the process.&lt;br /&gt;
&lt;br /&gt;
When a server is overloaded as opposed to being frozen, most times it is possible to get log in, and run utilities to identify the runaway process.&amp;nbsp; It may be very slow responding, but if all possible give it enough time and you will eventually get logged in.&amp;nbsp; Running the utilities to identify the runaway process varies, depending on whether you are on a Windows based machine, or UNIX/Linux.&amp;nbsp; I will go into the utilities used for this in a future blog. For now, just be aware that the utilities will probably also be slow to respond.&amp;nbsp; However, if you can get logged in, and the utilities do respond, you can probably kill the offending process, and free the system back up.&lt;br /&gt;
&lt;br /&gt;
There may be times that the server is so overloaded, that you will not be able to log in and kill processes.&amp;nbsp; In that case, you will have to resort to turning the power off, and risk corrupting files, but you really have no choice at that point.&amp;nbsp; This should be a last resort, and only done if you are not able to get into your system at all.&lt;/p&gt;
&lt;br /&gt;
&lt;br /&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Avoiding File Corruption&lt;/p&gt;
&lt;p class="std"&gt;No matter how well you maintain your system, there comes the time when it freezes up.&amp;nbsp; When that happens, you really have no choice other than to do a hard reset, by turning the power off, and back on.&amp;nbsp; Since there is an inherent risk that this will result in some file corruption, it should be avoided if at all possible.&amp;nbsp; Still, sometimes it is necessary.&lt;br /&gt;
&lt;br /&gt;
There are many times, however, when your system is not truly frozen, but is overloaded instead.&amp;nbsp; This is more common in a network environment, when users are running software that is server based.&amp;nbsp; In this case, it may appear to be frozen, as users get no response at their workstations.&amp;nbsp; However, what may really be happening, is that the server has become so busy, that it does not have time to respond to the requests from the workstation.&amp;nbsp; The appearance to the users is the same, but true cause is different.&lt;br /&gt;
&lt;br /&gt;
The difference is important, because if it is a matter of server overload, many times the process causing the overload can found and killed.&amp;nbsp; If this can be done, the risk of corrupting your data files is much less than if the system is simply powered down.&amp;nbsp; &lt;u&gt;The reason for this is that when a process is killed, in most cases, it closes the files that it has open as it goes down.&amp;nbsp; If the power is simply shut off, this does not occur.&lt;br /&gt;
&lt;/u&gt;&lt;br /&gt;
Check your system for any indications of activity, to determine if it is overloaded as opposed to being frozen.&amp;nbsp; In most cases, an overloaded system will have high disk usage.&amp;nbsp; You may be able to hear the disk drive working, or the disk activity light on the computer may be blinking very fast, or even on solid.&amp;nbsp; If that is the case, then you have a good chance of being able to get on and kill the process.&lt;br /&gt;
&lt;br /&gt;
When a server is overloaded as opposed to being frozen, most times it is possible to get log in, and run utilities to identify the runaway process.&amp;nbsp; It may be very slow responding, but if all possible give it enough time and you will eventually get logged in.&amp;nbsp; Running the utilities to identify the runaway process varies, depending on whether you are on a Windows based machine, or UNIX/Linux.&amp;nbsp; I will go into the utilities used for this in a future blog. For now, just be aware that the utilities will probably also be slow to respond.&amp;nbsp; However, if you can get logged in, and the utilities do respond, you can probably kill the offending process, and free the system back up.&lt;br /&gt;
&lt;br /&gt;
There may be times that the server is so overloaded, that you will not be able to log in and kill processes.&amp;nbsp; In that case, you will have to resort to turning the power off, and risk corrupting files, but you really have no choice at that point.&amp;nbsp; This should be a last resort, and only done if you are not able to get into your system at all.&lt;/p&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/bkHtteC4NPs" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1186-when-your-system-freezes-up</feedburner:origLink></entry>
	<entry>
		<title>SQL Triggers</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/JrKvHn6GSzU/1182-sql-triggers" />
		<published>2011-12-30T02:37:09Z</published>
		<updated>2011-12-30T02:37:09Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1182-sql-triggers</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Using SQL Triggers&lt;/p&gt;
&lt;p class="std"&gt;If you are using software based on SQL (Standard Query Language), such as Microsoft SQL, you have the ability to add triggers.&amp;nbsp; &lt;u&gt;A trigger is an event&lt;/u&gt; that is executed (triggered), when records are added, deleted, or changed, in the SQL database.&amp;nbsp; There are many uses for triggers.&lt;br /&gt;
&lt;br /&gt;
One that I did recently, puts records into a table, that is used by a secondary processing system that the customer has.&amp;nbsp; When the sale ticket uses specific pay codes, some of the data needs to be captured, to be used by software that is specific to part of their business.&amp;nbsp; By using a trigger on the tables used by the point of sale, this special table is immediately updated with the information needed by the second, specialized, application.&amp;nbsp; In other words, the second application has immediate access to the sale data, without the need to search through the information on many sales tickets that are not applicable.&amp;nbsp; The performance impact at the time the sale is made, is so minimal that it is not noticeable.&amp;nbsp; The improved performance eliminating&amp;nbsp;the search in the second application&amp;nbsp;is significant.&lt;br /&gt;
&lt;br /&gt;
That is the beauty of a SQL trigger.&amp;nbsp; The processing occurs automatically and, if properly designed, with no noticeable impact to the end user.&lt;br /&gt;
&lt;br /&gt;
Almost any processing can be done in a trigger.&amp;nbsp; In the case above, the payment code is checked, and if it is one of those needed by the second application, the necessary information is captured to a different table, and the sale process then goes on as in all other sales. &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Other application of SQL triggers that we have implemented, include re-calculating sales tax rates based on the sale location (a requirement in Washington state, among others), and automatically updating the sale price for repeat customers.&amp;nbsp; There are any number of possible uses for SQL triggers.&lt;br /&gt;
&lt;br /&gt;
While just about any processing can be performed in a trigger, the trigger must be properly designed so that it does not adversely impact the flow of business.&amp;nbsp; For example, in a point of sale system, you would not want to perform processing that could take several minutes.&amp;nbsp; Your customers do not want to wait those several minutes to get their receipt.&amp;nbsp; You could, however, flag the records for the additional processing, and have another procedure that performs the actual additional processing.&amp;nbsp; This additional processing could be made to happen automatically (which will be addressed in a future blog).&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Contact CCS Retail Technical Support for Custom CounterPoint SQL and Passport Business Systems &lt;a href="mailto:support@ccscentral.com?subject=SQL%20Custom%20Programming"&gt;SQL programming&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Using SQL Triggers&lt;/p&gt;
&lt;p class="std"&gt;If you are using software based on SQL (Standard Query Language), such as Microsoft SQL, you have the ability to add triggers.&amp;nbsp; &lt;u&gt;A trigger is an event&lt;/u&gt; that is executed (triggered), when records are added, deleted, or changed, in the SQL database.&amp;nbsp; There are many uses for triggers.&lt;br /&gt;
&lt;br /&gt;
One that I did recently, puts records into a table, that is used by a secondary processing system that the customer has.&amp;nbsp; When the sale ticket uses specific pay codes, some of the data needs to be captured, to be used by software that is specific to part of their business.&amp;nbsp; By using a trigger on the tables used by the point of sale, this special table is immediately updated with the information needed by the second, specialized, application.&amp;nbsp; In other words, the second application has immediate access to the sale data, without the need to search through the information on many sales tickets that are not applicable.&amp;nbsp; The performance impact at the time the sale is made, is so minimal that it is not noticeable.&amp;nbsp; The improved performance eliminating&amp;nbsp;the search in the second application&amp;nbsp;is significant.&lt;br /&gt;
&lt;br /&gt;
That is the beauty of a SQL trigger.&amp;nbsp; The processing occurs automatically and, if properly designed, with no noticeable impact to the end user.&lt;br /&gt;
&lt;br /&gt;
Almost any processing can be done in a trigger.&amp;nbsp; In the case above, the payment code is checked, and if it is one of those needed by the second application, the necessary information is captured to a different table, and the sale process then goes on as in all other sales. &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Other application of SQL triggers that we have implemented, include re-calculating sales tax rates based on the sale location (a requirement in Washington state, among others), and automatically updating the sale price for repeat customers.&amp;nbsp; There are any number of possible uses for SQL triggers.&lt;br /&gt;
&lt;br /&gt;
While just about any processing can be performed in a trigger, the trigger must be properly designed so that it does not adversely impact the flow of business.&amp;nbsp; For example, in a point of sale system, you would not want to perform processing that could take several minutes.&amp;nbsp; Your customers do not want to wait those several minutes to get their receipt.&amp;nbsp; You could, however, flag the records for the additional processing, and have another procedure that performs the actual additional processing.&amp;nbsp; This additional processing could be made to happen automatically (which will be addressed in a future blog).&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Contact CCS Retail Technical Support for Custom CounterPoint SQL and Passport Business Systems &lt;a href="mailto:support@ccscentral.com?subject=SQL%20Custom%20Programming"&gt;SQL programming&lt;/a&gt;.&lt;/p&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/JrKvHn6GSzU" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1182-sql-triggers</feedburner:origLink></entry>
	<entry>
		<title>SQL Performance</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/AN0XR9JZ-wE/1181-sql-performance" />
		<published>2011-12-30T02:36:19Z</published>
		<updated>2011-12-30T02:36:19Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1181-sql-performance</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Improving SQL Performance&lt;/p&gt;
&lt;p class="std"&gt;There are several factors that can affect the performance of your SQL system.&amp;nbsp; The obvious ones are of course the basic design of your database.&amp;nbsp; A properly designed database system has a minimum amount of redundant data.&amp;nbsp; There is no reason to store the same field of information in several different tables, if that information can be found from a single master table.&amp;nbsp; Keeping such redundancy out reduces the overall database size, which helps with performance.&lt;br /&gt;
&lt;br /&gt;
However, there are other, less obvious, factors that affect your SQL database.&lt;br /&gt;
&lt;br /&gt;
Microsoft SQL in particular, greatly benefits from having indexes rebuilt and statistics updated.&amp;nbsp; Properly designed indexes significantly speed up accessing the information in a table.&amp;nbsp; The issue is that, over time, these indexes become less optimized as new data is added, and old data is deleted.&amp;nbsp; When data in a table is updated, the old data is actually deleted, and the new data inserted, giving the index a double hit.&lt;br /&gt;
&lt;br /&gt;
Recently, I ran a script on several different SQL servers for a customers.&amp;nbsp; On some of the machines, the script ran in under three minutes.&amp;nbsp; On others, it was over 30 minutes.&amp;nbsp; Same script, similar hardware and database, and vastly different performance.&amp;nbsp; The difference was that some servers had been recently had the indexes rebuild&lt;br /&gt;
&lt;br /&gt;
When the SQL indexes are rebuilt, they are again running at a high level of optimization, which helped achieve the short run times mentioned above.&lt;br /&gt;
&lt;br /&gt;
A second major factor, with Microsoft SQL, is updating statistics.&amp;nbsp; MS-SQL keeps statistics on how particular tables are accessed, and these can be used to automatically tune the server to increase performance, also.&amp;nbsp; The impact of rebuilding indexes, and updating statistics, can be major.&amp;nbsp; You can see that in the difference in doing the same processing mentioned above.&lt;br /&gt;
&lt;br /&gt;
How often indexes need to be rebuilt, and statistics updated, depends mostly on how active the database is.&amp;nbsp; In a high activity system, these should be done frequently.&amp;nbsp; Lower activity systems less frequently.&amp;nbsp; My minimum recommendation would be to re-index and update statistics weekly.&amp;nbsp; We have several customers that are setup to do this every night, as they have higher activity levels.&lt;br /&gt;
&lt;br /&gt;
Also, if any major database processing is done, such as updating most or all records in a table, a re-index and update of statistics is called for.&lt;br /&gt;
&lt;br /&gt;
Contact CCS Retail Technical Support for Custom CounterPoint SQL&amp;nbsp;and Passport Business Systems &lt;a href="mailto:support@ccscentral.com?subject=SQL%20Custom%20Programming"&gt;SQL programming&lt;/a&gt;.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;br /&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Improving SQL Performance&lt;/p&gt;
&lt;p class="std"&gt;There are several factors that can affect the performance of your SQL system.&amp;nbsp; The obvious ones are of course the basic design of your database.&amp;nbsp; A properly designed database system has a minimum amount of redundant data.&amp;nbsp; There is no reason to store the same field of information in several different tables, if that information can be found from a single master table.&amp;nbsp; Keeping such redundancy out reduces the overall database size, which helps with performance.&lt;br /&gt;
&lt;br /&gt;
However, there are other, less obvious, factors that affect your SQL database.&lt;br /&gt;
&lt;br /&gt;
Microsoft SQL in particular, greatly benefits from having indexes rebuilt and statistics updated.&amp;nbsp; Properly designed indexes significantly speed up accessing the information in a table.&amp;nbsp; The issue is that, over time, these indexes become less optimized as new data is added, and old data is deleted.&amp;nbsp; When data in a table is updated, the old data is actually deleted, and the new data inserted, giving the index a double hit.&lt;br /&gt;
&lt;br /&gt;
Recently, I ran a script on several different SQL servers for a customers.&amp;nbsp; On some of the machines, the script ran in under three minutes.&amp;nbsp; On others, it was over 30 minutes.&amp;nbsp; Same script, similar hardware and database, and vastly different performance.&amp;nbsp; The difference was that some servers had been recently had the indexes rebuild&lt;br /&gt;
&lt;br /&gt;
When the SQL indexes are rebuilt, they are again running at a high level of optimization, which helped achieve the short run times mentioned above.&lt;br /&gt;
&lt;br /&gt;
A second major factor, with Microsoft SQL, is updating statistics.&amp;nbsp; MS-SQL keeps statistics on how particular tables are accessed, and these can be used to automatically tune the server to increase performance, also.&amp;nbsp; The impact of rebuilding indexes, and updating statistics, can be major.&amp;nbsp; You can see that in the difference in doing the same processing mentioned above.&lt;br /&gt;
&lt;br /&gt;
How often indexes need to be rebuilt, and statistics updated, depends mostly on how active the database is.&amp;nbsp; In a high activity system, these should be done frequently.&amp;nbsp; Lower activity systems less frequently.&amp;nbsp; My minimum recommendation would be to re-index and update statistics weekly.&amp;nbsp; We have several customers that are setup to do this every night, as they have higher activity levels.&lt;br /&gt;
&lt;br /&gt;
Also, if any major database processing is done, such as updating most or all records in a table, a re-index and update of statistics is called for.&lt;br /&gt;
&lt;br /&gt;
Contact CCS Retail Technical Support for Custom CounterPoint SQL&amp;nbsp;and Passport Business Systems &lt;a href="mailto:support@ccscentral.com?subject=SQL%20Custom%20Programming"&gt;SQL programming&lt;/a&gt;.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/AN0XR9JZ-wE" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1181-sql-performance</feedburner:origLink></entry>
	<entry>
		<title>Some thoughts on training</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/aMOy3vepKUU/1158-some-thoughts-on-training" />
		<published>2011-12-01T01:05:49Z</published>
		<updated>2011-12-01T01:05:49Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1158-some-thoughts-on-training</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Hands-on Training Justification&lt;/p&gt;
&lt;p class="std"&gt;So you just got the latest and greatest software, now what.&amp;nbsp; Obviously, you need to know how to use it.&amp;nbsp; While you can dig through the manuals, and try to figure it out on your own, you would probably benefit much more from hands on training.&lt;br /&gt;
&lt;br /&gt;
There are many advantages to taking a training course:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Being in a dedicated training environment, you are not distracted by the many interruptions in your day.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;No stopping and starting, and trying to remember where you were.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;You can concentrate on learning your new software, and finding out how it can be used to best suit your needs.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;Which of the myriad of setup options best suits your needs?&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;In a training class you can ask questions from an experienced person.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;You can also find out what the implications are of choosing any particular settings, and why one is better than another for your particular needs.&lt;/li&gt;
    &lt;li&gt;Your questions can be answered while they are still fresh in your mind.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;No need to write them down, and then try to remember what the circumstances were that brought on the question in the first place.&lt;/li&gt;
&lt;/ul&gt;
Ideally, your training course will be geared to your specific needs.&amp;nbsp; In that case, you will be able to go through all of the setup steps, discussing the options and how they pertain to your needs.&amp;nbsp; You will be able to ask questions, and discuss the options, to be able to choose the ideal setup.&amp;nbsp; Going forward, you will be able to go through the type of processing that you do on a daily basis, to see just how those tasks would be carried out in your live environment.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;In short, half a day, or a day, spent in such targeted training, will yield much greater results than spending a day trying to figure it out on your own.&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="mailto:training@ccscentral.com?subject=Training%20Classes"&gt;Contact CCS Retail&lt;/a&gt; for your training needs.&lt;br /&gt;
&lt;br /&gt;
Dave.&lt;br /&gt;
&lt;br /&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Hands-on Training Justification&lt;/p&gt;
&lt;p class="std"&gt;So you just got the latest and greatest software, now what.&amp;nbsp; Obviously, you need to know how to use it.&amp;nbsp; While you can dig through the manuals, and try to figure it out on your own, you would probably benefit much more from hands on training.&lt;br /&gt;
&lt;br /&gt;
There are many advantages to taking a training course:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Being in a dedicated training environment, you are not distracted by the many interruptions in your day.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;No stopping and starting, and trying to remember where you were.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;You can concentrate on learning your new software, and finding out how it can be used to best suit your needs.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;Which of the myriad of setup options best suits your needs?&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;In a training class you can ask questions from an experienced person.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;You can also find out what the implications are of choosing any particular settings, and why one is better than another for your particular needs.&lt;/li&gt;
    &lt;li&gt;Your questions can be answered while they are still fresh in your mind.&amp;nbsp;&lt;/li&gt;
    &lt;li&gt;No need to write them down, and then try to remember what the circumstances were that brought on the question in the first place.&lt;/li&gt;
&lt;/ul&gt;
Ideally, your training course will be geared to your specific needs.&amp;nbsp; In that case, you will be able to go through all of the setup steps, discussing the options and how they pertain to your needs.&amp;nbsp; You will be able to ask questions, and discuss the options, to be able to choose the ideal setup.&amp;nbsp; Going forward, you will be able to go through the type of processing that you do on a daily basis, to see just how those tasks would be carried out in your live environment.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;In short, half a day, or a day, spent in such targeted training, will yield much greater results than spending a day trying to figure it out on your own.&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="mailto:training@ccscentral.com?subject=Training%20Classes"&gt;Contact CCS Retail&lt;/a&gt; for your training needs.&lt;br /&gt;
&lt;br /&gt;
Dave.&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/aMOy3vepKUU" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1158-some-thoughts-on-training</feedburner:origLink></entry>
	<entry>
		<title>More on creating good passwords</title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~3/3s4CiNvfO3o/1157-more-on-creating-good-passwords" />
		<published>2011-12-01T01:05:10Z</published>
		<updated>2011-12-01T01:05:10Z</updated>
		<id>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1157-more-on-creating-good-passwords</id>
		<author>
			<name>David Russell</name>
		<email>davidr@ccscentral.com</email>
		</author>
		<summary type="html">&lt;p class="headPara"&gt;Creating Good Passwords&lt;/p&gt;
&lt;p class="std"&gt;If you process credit cards in your retail operation, you should be aware of the requirement to change passwords every 90 days.&amp;nbsp; Those of you who do not take credit cards, should change your passwords frequently, too.&lt;br /&gt;
&lt;br /&gt;
I have discussed what makes a good password before.&amp;nbsp; In brief, a mixture of upper and lower case letters, numbers, and special characters, such as !, #, @, etc.&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The longer the password the better.&amp;nbsp; Pick a value between 16 and 32 characters.&amp;nbsp;&amp;nbsp; To help you create and use the passwords consider using a keeper program such as Keepass.&amp;nbsp;&amp;nbsp; They will generate passwords for you and allow you to use the clipboard to paste them later rather than trying to enter them on the keyboard.&amp;nbsp;&amp;nbsp; They also defeat key loggers that may be hidden on your system.&lt;br /&gt;
&lt;br /&gt;
There are additional considerations to look at.&amp;nbsp; Recently, I have seen some articles and passwords, and found it very interesting that one of the common passwords is &amp;quot;qwerty&amp;quot;.&amp;nbsp; While this may look like a fairly good choice, if you check, it is the string of letters on the third row of your keyboard.&amp;nbsp; The pattern is where the problem lies.&lt;br /&gt;
&lt;br /&gt;
Anything with a pattern is not a good choice for a password.&amp;nbsp; Patterns on the keyboard (such as &amp;quot;qwerty&amp;quot;), and sequence patterns (such as &amp;quot;abcde&amp;quot;) make very poor choices.&amp;nbsp; Adding such a pattern to a base word is not much better.&amp;nbsp; Something like &amp;quot;someword123&amp;quot; is little improvement over using &amp;quot;someword&amp;quot; as your password.&lt;br /&gt;
&lt;br /&gt;
Password hacking software is getting more sophisticated all the time.&amp;nbsp; Giving it easy targets, by using predictable patterns for your password, is asking for trouble.&amp;nbsp; Take a little time, and put some thought into it, and you will be able to come up with a good, complex, password that you will be able to remember.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="mailto:support@ccscentral.com?subject=Creating%20good%20passwords"&gt;Contact us &lt;/a&gt;if you need more help.&lt;br /&gt;
&lt;br /&gt;
Dave.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;</summary>
		<content type="html">&lt;p class="headPara"&gt;Creating Good Passwords&lt;/p&gt;
&lt;p class="std"&gt;If you process credit cards in your retail operation, you should be aware of the requirement to change passwords every 90 days.&amp;nbsp; Those of you who do not take credit cards, should change your passwords frequently, too.&lt;br /&gt;
&lt;br /&gt;
I have discussed what makes a good password before.&amp;nbsp; In brief, a mixture of upper and lower case letters, numbers, and special characters, such as !, #, @, etc.&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The longer the password the better.&amp;nbsp; Pick a value between 16 and 32 characters.&amp;nbsp;&amp;nbsp; To help you create and use the passwords consider using a keeper program such as Keepass.&amp;nbsp;&amp;nbsp; They will generate passwords for you and allow you to use the clipboard to paste them later rather than trying to enter them on the keyboard.&amp;nbsp;&amp;nbsp; They also defeat key loggers that may be hidden on your system.&lt;br /&gt;
&lt;br /&gt;
There are additional considerations to look at.&amp;nbsp; Recently, I have seen some articles and passwords, and found it very interesting that one of the common passwords is &amp;quot;qwerty&amp;quot;.&amp;nbsp; While this may look like a fairly good choice, if you check, it is the string of letters on the third row of your keyboard.&amp;nbsp; The pattern is where the problem lies.&lt;br /&gt;
&lt;br /&gt;
Anything with a pattern is not a good choice for a password.&amp;nbsp; Patterns on the keyboard (such as &amp;quot;qwerty&amp;quot;), and sequence patterns (such as &amp;quot;abcde&amp;quot;) make very poor choices.&amp;nbsp; Adding such a pattern to a base word is not much better.&amp;nbsp; Something like &amp;quot;someword123&amp;quot; is little improvement over using &amp;quot;someword&amp;quot; as your password.&lt;br /&gt;
&lt;br /&gt;
Password hacking software is getting more sophisticated all the time.&amp;nbsp; Giving it easy targets, by using predictable patterns for your password, is asking for trouble.&amp;nbsp; Take a little time, and put some thought into it, and you will be able to come up with a good, complex, password that you will be able to remember.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="mailto:support@ccscentral.com?subject=Creating%20good%20passwords"&gt;Contact us &lt;/a&gt;if you need more help.&lt;br /&gt;
&lt;br /&gt;
Dave.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/RetailSystemsTechnicalAdviceDavesBlog/~4/3s4CiNvfO3o" height="1" width="1"/&gt;</content>
	<feedburner:origLink>http://www.ccscentral.com/ccs-blogs/ccs-retail-systems-daves-blog/1157-more-on-creating-good-passwords</feedburner:origLink></entry>
</feed>

