<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title> &#187; Alerts</title>
	<atom:link href="http://www.90minds.com/category/sap-business-one/alerts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.90minds.com</link>
	<description></description>
	<lastBuildDate>Fri, 30 Jul 2010 17:13:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SAP Business One Query to Show Open Balances by Customer (or Vendor)</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-open-balances-by-customer-or-vendor/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-open-balances-by-customer-or-vendor/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 17:11:44 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-open-balances-by-customer-or-vendor/</guid>
		<description><![CDATA[Use this query to show you a list of open balances by customer group. If you would like to see 
open balances by vendor, then change the Where clause to cs.cardtype = &#8216;S&#8217;.
/* Shows the open balances by Customer Group */   SELECT gp.GroupCode, gp.GroupName, Sum(cs.Balance) &#8216;Open Balance&#8217;
FROM OCRD cs   INNER JOIN [...]]]></description>
			<content:encoded><![CDATA[<p>Use this query to show you a list of open balances by customer group. If you would like to see </p>
<p>open balances by vendor, then change the <em>Where</em> clause to <em>cs.cardtype = &#8216;S&#8217;</em>.</p>
<p>/* Shows the open balances by Customer Group */   <br />SELECT gp.GroupCode, gp.GroupName, Sum(cs.Balance) &#8216;Open Balance&#8217;</p>
<p>FROM OCRD cs   <br />INNER JOIN OCRG gp ON gp.GroupCode = cs.GroupCode </p>
<p>WHERE cs.CardType = &#8216;C&#8217;</p>
<p>GROUP BY gp.GroupCode, gp.GroupName   <br />ORDER BY GroupName    <br />FOR BROWSE</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-open-balances-by-customer-or-vendor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One Alerts Check for BP Tax Codes</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-alerts-check-for-bp-tax-codes/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-alerts-check-for-bp-tax-codes/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 17:05:40 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-alerts-check-for-bp-tax-codes/</guid>
		<description><![CDATA[If a state tax code was not entered on the Customer&#8217;s Ship-To address then when the Sales Order is invoiced you will receive a message stating that the tax code was not provided for the order. This Alert will notify someone when the tax code was not entered. Create a Query with the following SQL [...]]]></description>
			<content:encoded><![CDATA[<p>If a state tax code was not entered on the Customer&#8217;s Ship-To address then when the Sales Order is invoiced you will receive a message stating that the tax code was not provided for the order. This Alert will notify someone when the tax code was not entered. Create a Query with the following SQL and associate it with an alert:   <br />SELECT     <br />T1.CardCode AS &#8216;BP Code&#8217;    <br />,T1.CardName AS &#8216;BP Name&#8217;    <br />,T0.TaxCode AS &#8216;Tax Code&#8217;     <br />FROM [dbo].[CRD1] T0     <br />INNER JOIN [dbo].[OCRD] T1 ON T1.CardCode = T0.CardCode     <br />WHERE T0.TaxCode = &#8216; &#8216; AND T0.AdresType = N&#8217;S&#8217; AND T1.CardType = N&#8217;C&#8217;     <br />FOR BROWSE</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-alerts-check-for-bp-tax-codes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One Birthday List! (without the year)</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-birthday-list-without-the-year/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-birthday-list-without-the-year/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:46:52 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Financials]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-birthday-list-without-the-year/</guid>
		<description><![CDATA[A quick and easy query to give you a list of the birthdays from the Employee Master Data application in SBO.
Copy and paste the lines below into the Query Generator tool.
/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/   /* Displays a list of all the employees in SBO with their birthdays (without the year) */
SELECT   lastname as &#8216;Last [...]]]></description>
			<content:encoded><![CDATA[<p>A quick and easy query to give you a list of the birthdays from the <em>Employee Master Data</em> application in SBO.</p>
<p>Copy and paste the lines below into the <em>Query Generator</em> tool.</p>
<p>/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/   <br />/* Displays a list of all the employees in SBO with their birthdays (without the year) */</p>
<p>SELECT   <br />lastname as &#8216;Last Name&#8217;    <br />,firstname as &#8216;First Name&#8217;</p>
<p>,Case When birthdate is Null then &#8216;Not Entered&#8217; Else   <br />CASE len(CONVERT(varchar(2), datepart(mm, birthdate)))    <br />WHEN 1 THEN &#8216;0&#8242; + CONVERT(varchar(1), datepart(mm, birthdate))    <br />ELSE CONVERT(varchar(2), datepart(mm, birthdate))    <br />END    <br />+ &#8216;/&#8217; +    <br />CASE len(CONVERT(varchar(2), datepart(dd, birthdate)))    <br />WHEN 1 THEN &#8216;0&#8242; + CONVERT(varchar(1), datepart(dd, birthdate))    <br />ELSE CONVERT(varchar(2), datepart(dd, birthdate))    <br />END </p>
<p>END AS Birthday</p>
<p>FROM OHEM   <br />Order by birthday, lastname, firstname</p>
<p>/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/</p>
<p>If you wanted to <strong>access the <em>Employee Master</em></strong> from this query you could add:</p>
<p><em>empid,</em></p>
<p>after the <em>Select</em></p>
<p>and </p>
<p><em>FOR BROWSE</em></p>
<p>on the line following the <em>Order By</em></p>
<p>If you would like to <strong>make this query into an alert</strong>, you could do all of the above <u>and</u> add the line </p>
<p><em>WHERE birthdate is not null</em></p>
<p>between the <em>FROM OHEM</em> and the <em>Order By</em>.</p>
<p>That would look like:</p>
<p>/* Displays a list of all the employees in SBO with their birthdays */   <br />/*(without the year) */</p>
<p>SELECT   <br />empid as &#8216;ID&#8217;    <br />,lastname as &#8216;Last Name&#8217;    <br />,firstname as &#8216;First Name&#8217;</p>
<p>,Case When birthdate is Null then &#8216;Not Entered&#8217; Else   <br />CASE len(CONVERT(varchar(2), datepart(mm, birthdate)))    <br />WHEN 1 THEN &#8216;0&#8242; + CONVERT(varchar(1), datepart(mm, birthdate))    <br />ELSE CONVERT(varchar(2), datepart(mm, birthdate))    <br />END    <br />+ &#8216;/&#8217; +    <br />CASE len(CONVERT(varchar(2), datepart(dd, birthdate)))    <br />WHEN 1 THEN &#8216;0&#8242; + CONVERT(varchar(1), datepart(dd, birthdate))    <br />ELSE CONVERT(varchar(2), datepart(dd, birthdate))    <br />END    <br />END AS Birthday</p>
<p>FROM OHEM   <br />WHERE birthdate is not null    <br />Order by birthday, lastname, firstname    <br />FOR BROWSE</p>
<p>&#160;</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-birthday-list-without-the-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One: High Quantity on a Sales Order</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-high-quantity-on-a-sales-order/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-high-quantity-on-a-sales-order/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:45:51 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Formatted Search]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-high-quantity-on-a-sales-order/</guid>
		<description><![CDATA[Use this query to check for high order quantities on a Sales Orders. 
If you make an alert out of this query, then you can be notified when potential keying errors occur. 
/* Shows all sales orders where the qty ordered is greater */   /* than or equal to the amount within the [...]]]></description>
			<content:encoded><![CDATA[<p>Use this query to check for high order quantities on a <em>Sales Orders</em>. </p>
<p>If you make an alert out of this query, then you can be notified when potential keying errors occur. </p>
<p>/* Shows all sales orders where the qty ordered is greater */   <br />/* than or equal to the amount within the WHERE Clause below */    <br />Select     <br />DocNum as &#8216;Order#&#8217;    <br />,itemcode as &#8216;Item#&#8217;    <br />,dscription as &#8216;Description&#8217;    <br />,Quantity    <br />,Gtotal &#8216;Line Total&#8217;    <br />,cardcode as &#8216;BP&#8217;    <br />,cardname as &#8216;BP Name&#8217;</p>
<p>FROM rdr1 dtl   <br />INNER JOIN ordr hdr on dtl.docentry = hdr.docentry</p>
<p>WHERE   <br />Linestatus = &#8216;O&#8217;    <br />and Quantity&gt;=100</p>
<p>Order By DocNum, LineNum   <br />FOR BROWSE</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-high-quantity-on-a-sales-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One: Query to Show Customers Without Sales Employees Assigned</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-customers-without-sales-employees-assigned/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-customers-without-sales-employees-assigned/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:44:59 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Formatted Search]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-customers-without-sales-employees-assigned/</guid>
		<description><![CDATA[Use the query to show all of the customers that do not have sales employees assigned. You can use this as an alert as well.
SELECT CardCode as BP, CardName as &#8216;Customer Name&#8217; FROM OCRD Where SLPCODE = -1 and CardType = &#8216;C&#8217; FOR BROWSE
Thanks to Ed Monk of SBONotes.com
]]></description>
			<content:encoded><![CDATA[<p>Use the query to show all of the customers that do not have sales employees assigned. You can use this as an alert as well.</p>
<p>SELECT CardCode as BP, CardName as &#8216;Customer Name&#8217; FROM OCRD Where SLPCODE = -1 and CardType = &#8216;C&#8217; FOR BROWSE</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-query-to-show-customers-without-sales-employees-assigned/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One: Commonly Used Tables for Queries</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-commonly-used-tables-for-queries/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-commonly-used-tables-for-queries/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:41:22 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Formatted Search]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-commonly-used-tables-for-queries/</guid>
		<description><![CDATA[For those who would like to try their hand at doing some queries for formatted searches, alerts, or reports, but do not know what the common table names are, here is a short list. Check back and I will update the list from time to time.
Master Files:    OITM = Item Master  [...]]]></description>
			<content:encoded><![CDATA[<p>For those who would like to try their hand at doing some queries for formatted searches, alerts, or reports, but do not know what the common table names are, here is a short list. Check back and I will update the list from time to time.</p>
<p>Master Files:    <br />OITM = Item Master    <br />OCRD = Customer, Vendor, and Lead Master    <br />CRD1 = Customer Master Address    <br />OCRG = Customer Master Group Code    <br />OHEM = Employee Master    <br />OUSR = SBO Users</p>
<p>Document Files:    <br />ORDR = Sales Order Header    <br />RDR1 = Sales Order Detail (Items) </p>
<p>OINV = Invoice Header   <br />INV1 = Invoice Line Details (Items)</p>
<p>&#160;</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-commonly-used-tables-for-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Custom Queries in SAP Business One</title>
		<link>http://www.90minds.com/2009/02/11/creating-custom-queries-in-sap-business-one/</link>
		<comments>http://www.90minds.com/2009/02/11/creating-custom-queries-in-sap-business-one/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:37:48 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[Reporting]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/creating-custom-queries-in-sap-business-one/</guid>
		<description><![CDATA[There are two tools for creating custom queries in SAP Business One, both of which will walk you through making your own query:

Query Generator
Query Wizard

The end result of both tools listed above is a results window with the actual query statement in the top portion of the window and any data that was retrieved in [...]]]></description>
			<content:encoded><![CDATA[<p>There are two tools for creating custom queries in SAP Business One, both of which will walk you through making your own query:</p>
<ol>
<li>Query Generator</li>
<li>Query Wizard</li>
</ol>
<p>The end result of both tools listed above is a results window with the actual query statement in the top portion of the window and any data that was retrieved in the bottom section. I generally use an external query writer to create my Query (SQL) statements and to work out the final results because the screen editor does not allow you to re-size the query statement work area, which makes it hard to work on a query that is long.</p>
<p>So, assuming you are using an external editor, the only way I have found to get a new query into SAP Business One is to:</p>
<ol>
<li>Start the Query Generator (located under the <em>Reports</em> menu on the main menu) and click the <strong><em>Execute</em> </strong>button when the window opens (beginning in v2007, go to <em>Tools</em> on the drop down menu and select <em>Queries</em>).</li>
<li>The Query Results window is displayed, but there is nothing in the results. In the query statement box above, you will see &quot;SELECT *&#8217;. We will be replacing this with your query.</li>
<li>Click the pencil icon to the left of the query statement window. This allows you to edit the query.</li>
<li>Position your cursor in the grey area where the current query statement is and remove the &quot;SELECT *&#8217; or modify it to match your current query. The field supports common editing (Copy, Cut, Delete, and Paste) by right clicking the grey area. put your query in that space.</li>
<li><strong>Save your query</strong>. There is a button in the lower right hand side of the window. The <em>Query Manager</em> window will appear. Enter in your query&#8217;s name and select a category. </li>
</ol>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/creating-custom-queries-in-sap-business-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAP Business One The Anatomy of a SQL Statement: Rename your columns and tables (Part 3)</title>
		<link>http://www.90minds.com/2009/02/11/sap-business-one-the-anatomy-of-a-sql-statement-rename-your-columns-and-tables-part-3/</link>
		<comments>http://www.90minds.com/2009/02/11/sap-business-one-the-anatomy-of-a-sql-statement-rename-your-columns-and-tables-part-3/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:29:08 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Formatted Search]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/sap-business-one-the-anatomy-of-a-sql-statement-rename-your-columns-and-tables-part-3/</guid>
		<description><![CDATA[Using the example from the previous lesson, lets look at how we can make a SQL query more user friendly.
SELECT ItemCode, ItemName FROM OITM    The fields ItemCode and ItemName will appear as the column names for the data when the query is executed. Many times the field names (the ones from the [...]]]></description>
			<content:encoded><![CDATA[<p>Using the example from the previous lesson, lets look at how we can make a SQL query more user friendly.</p>
<p>SELECT ItemCode, ItemName FROM OITM    <br />The fields ItemCode and ItemName will appear as the column names for the data when the query is executed. Many times the field names (the ones from the actual table) do not accurately express what the field means. To rename the field to something else you can specify the new name right after the field name.</p>
<p>SELECT ItemCode AS Item, ItemName AS Description FROM OITM    <br />The &#8220;AS&#8221; keyword is not required, but aids in readability, so this syntax is also valid:</p>
<p>SELECT ItemCode Item, ItemName Description FROM OITM</p>
<p>If you attempt to use a special character (such as &#8220;#&#8221;) you may encounter issues. Enclose the new name in quotes and SBO will accept the name.    <br />As your queries become more complicated, you will have the desire to rename the files used within the query to make them easier to reference to. Additionally, when you have two files that have fields with the same field name, you must specify the file name and the field name every time you refer to the field in the query. For example, there is an ItemCode field in the Item Master (OITM) and the Order Detail (RDR1). Since both fields have the same name, you will have to specify the file name then the field name to tell the system which field you are referring to. If two files were being used in the previous query, then I would need to specify the file name too. The query below produces the same results as the previous examples:</p>
<p>SELECT OITM.ItemCode AS Item, OITM.ItemName AS Description FROM OITM    <br />If you had a large number of fields that you were selecting from one or more files it may become cumbersome to type &#8220;OITM&#8221; over and over again. You can rename it to something shorter. When you use the query tools from SBO, the system will rename the files for you. SBO renames the files to &#8220;Tn&#8221; (i.e., T0 for table one, T1 for table two). You can rename the files by specifying the new name    <br />right after the file name (in this case the file name is OITM for the item master file).</p>
<p>SELECT it.ItemCode AS Item, it.ItemName AS Description FROM OITM it</p>
<p>As you can see above, the shorter file name will make it a little easier to add lots of fields.</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/sap-business-one-the-anatomy-of-a-sql-statement-rename-your-columns-and-tables-part-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Anatomy of a SQL Statement &#8211; SQL Statement Breakdown (Part 2)</title>
		<link>http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-sql-statement-breakdown-part-2/</link>
		<comments>http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-sql-statement-breakdown-part-2/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:27:01 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Formatted Search]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-sql-statement-breakdown-part-2/</guid>
		<description><![CDATA[In the previous discussion I introduced a simple SQL query that selected all of the customer numbers and names from the SAP Customer/Vendor/Lead Master file. The query actually selects all three types (customers, vendors, and leads) because SBO uses one table/file to store this information. How you will know which type you are looking at [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous discussion I introduced a simple SQL query that selected all of the customer numbers and names from the SAP Customer/Vendor/Lead Master file. The query actually selects all three types (customers, vendors, and leads) because SBO uses one table/file to store this information. How you will know which type you are looking at is controlled by a type field within the table (CardType). We will add that field so that you can see the differences between the different types of records.<br />
Some more advanced users will note that there is no semicolon at the end of this statement. Many database management systems require a semicolon to indicate the end of the statement, but Microsoft SQL server does not. If fact, if you attempt to use a semicolon with this query within SBO, you will receive an error (and not very informative one at that) at the bottom of your screen.</p>
<p>SELECT CardCode, CardName, CardType FROM OCRD</p>
<p>This basic query will work in SBO as is. As long as you are using the SELECT keyword, you do not have to fear that you are going to change or corrupt the SBO data. The SELECT statement only reads data, it does not change data. It may be a good idea to make several smaller queries, like this one, as starter templates for other queries. The statement can appear on one line or multiple lines, it does not matter. The following statement produces the same result:</p>
<p>SELECT CardCode,Card NameFROM OCRD</p>
<p>Note that the CardCode (Customer Number) is listed before the CardName (Customer Name). The order in which you list your fields is important because that is the same order the system will display them in. Imagine a spreadsheet, the customer number will appear in column one and the customer name in column two.</p>
<p>Let’s take a look at the components of the statement:</p>
<ul>
<li>SELECT = Tells the system that you are about to select values from one or more tables (files) in SBO.</li>
<li>CardCode, CardName, CardType = Are the fields or values that you want to display in your report. List each field name separated by a comma (remember, no comma after the last field).</li>
<li>FROM = in a simple query, the FROM keyword only appears once for each SELECT. It indicates from what tables or files are the source for the fields that you listed above. It is possible to have a query inside another query, but that is another discussion.</li>
<li>OCRD = The official name for the SAP Business One Customer/Vendor/Lead table.</li>
</ul>
<p>The same concept can be applied to other tables in SBO. Let’s look at a basic query for the Item Master:</p>
<p>SELECT ItemCode, ItemName FROM OITM</p>
<p>Note that some of the elements changed, but not all of them. The SELECT and FROM do not change, but the field names (values) and the table/file name did. Apply this same formatting to other tables and you will be on your way to creating more advanced queries.</p>
<p>The final part, Part 3 is <a href="http://www.90minds.com/2009/02/11/sap-business-one-the-anatomy-of-a-sql-statement-rename-your-columns-and-tables-part-3/" target="_self">HERE</a>.</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-sql-statement-breakdown-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Anatomy of a SQL Statement &#8211; The Basics (Part 1)</title>
		<link>http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-the-basics-part-1/</link>
		<comments>http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-the-basics-part-1/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 16:24:15 +0000</pubDate>
		<dc:creator>Mark Chinsky</dc:creator>
				<category><![CDATA[Alerts]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Formatted Search]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[SAP Business One]]></category>

		<guid isPermaLink="false">http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-the-basics-part-1/</guid>
		<description><![CDATA[The Basics
Writing your own query for SAP (or any system) can be very satisfying and cost effective, if you are a user of SBO. Once you understand the basics, you will be able to direct your computer to give you exactly what information you are looking for from the system.
Most systems have some common elements [...]]]></description>
			<content:encoded><![CDATA[<p>The Basics<br />
Writing your own query for SAP (or any system) can be very satisfying and cost effective, if you are a user of SBO. Once you understand the basics, you will be able to direct your computer to give you exactly what information you are looking for from the system.</p>
<p>Most systems have some common elements such as Customers, Vendors, Items, and Orders. SBO is no different than any other system in that regard. Each of those elements are stored in tables (or files). If you are familiar with Excel Spreadsheets, then you can grasp the concept of a table. A Table stores information in rows, and for each row, the columns represent different pieces of information that are specific to the row. For example, if we were to look a Customer Master table, the customer numbers would appear in the first column and the corresponding customer name would appear in the second (just like an Excel spreadsheet).</p>
<p>Every system (SAP, MS, etc.) probably has a customer master, but the name of the table is different from one system to another. In SBO, the customer master is called “OCRD”. This is the name that you will use to refer to the customer master in your queries.</p>
<p>Let’s write a query statement in plain English first to get an idea of what information we would like to get out of the system:<br />
“I would like to have a list of all of the customer numbers and names.”</p>
<p>After converting the statement to SQL we will have:<br />
SELECT CardCode, CardName FROM OCRD</p>
<p>Part 2 is <a href="http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-sql-statement-breakdown-part-2/" target="_self">HERE</a>.</p>
<p>Thanks to Ed Monk of <a href="http://www.sbonotes.com">SBONotes.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.90minds.com/2009/02/11/the-anatomy-of-a-sql-statement-the-basics-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
