<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SQL syntax - Help in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SQL-syntax-Help/m-p/167309#M38918</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I am stucked with this problem. I just cant's get this to work. I am trying create a stored procedure to produce a list of products using 3 parameters from 3 different tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE PROCEDURE sp_product_listing&lt;/P&gt;&lt;P&gt;(@vproduct varchar(40),&lt;/P&gt;&lt;P&gt;@vmonth datetime=June,&lt;/P&gt;&lt;P&gt;@vyear datetime=2001)&lt;/P&gt;&lt;P&gt;as&lt;/P&gt;&lt;P&gt;SELECT 'product_name'=products.name, products.unit_price,&lt;/P&gt;&lt;P&gt;products.quantity_in_stock, 'supplier_name'=suppliers.name&lt;/P&gt;&lt;P&gt;FROM products&lt;/P&gt;&lt;P&gt;Inner Join suppliers ON products.supplier_id=suppliers.supplier_id&lt;/P&gt;&lt;P&gt;inner join order_details ON products.product_id=order_details.product_id&lt;/P&gt;&lt;P&gt;Inner join orders ON orders.order_id=order_details.order_id&lt;/P&gt;&lt;P&gt;WHERE products.name=@vproduct AND&lt;/P&gt;&lt;P&gt;datepart(month,orders.order_date)=@vmonth AND&lt;/P&gt;&lt;P&gt;datepart(year,orders.order_date)=@vyear&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go&lt;/P&gt;&lt;P&gt;EXECUTE sp_product_listing 'jack' , 'June' , '2001'&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;I get this ERROR: Msg 8114, Level 16, State 5, Procedure sp_product_listing, Line 0&lt;/P&gt;&lt;P&gt;Error converting data type varchar to datetime.&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Can anyone help me. what am I doing wrong?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Arlyn&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Nov 2009 07:38:08 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-11-27T07:38:08Z</dc:date>
    <item>
      <title>SQL syntax - Help</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-syntax-Help/m-p/167309#M38918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I am stucked with this problem. I just cant's get this to work. I am trying create a stored procedure to produce a list of products using 3 parameters from 3 different tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE PROCEDURE sp_product_listing&lt;/P&gt;&lt;P&gt;(@vproduct varchar(40),&lt;/P&gt;&lt;P&gt;@vmonth datetime=June,&lt;/P&gt;&lt;P&gt;@vyear datetime=2001)&lt;/P&gt;&lt;P&gt;as&lt;/P&gt;&lt;P&gt;SELECT 'product_name'=products.name, products.unit_price,&lt;/P&gt;&lt;P&gt;products.quantity_in_stock, 'supplier_name'=suppliers.name&lt;/P&gt;&lt;P&gt;FROM products&lt;/P&gt;&lt;P&gt;Inner Join suppliers ON products.supplier_id=suppliers.supplier_id&lt;/P&gt;&lt;P&gt;inner join order_details ON products.product_id=order_details.product_id&lt;/P&gt;&lt;P&gt;Inner join orders ON orders.order_id=order_details.order_id&lt;/P&gt;&lt;P&gt;WHERE products.name=@vproduct AND&lt;/P&gt;&lt;P&gt;datepart(month,orders.order_date)=@vmonth AND&lt;/P&gt;&lt;P&gt;datepart(year,orders.order_date)=@vyear&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go&lt;/P&gt;&lt;P&gt;EXECUTE sp_product_listing 'jack' , 'June' , '2001'&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;I get this ERROR: Msg 8114, Level 16, State 5, Procedure sp_product_listing, Line 0&lt;/P&gt;&lt;P&gt;Error converting data type varchar to datetime.&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Can anyone help me. what am I doing wrong?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Arlyn&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Nov 2009 07:38:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-syntax-Help/m-p/167309#M38918</guid>
      <dc:creator />
      <dc:date>2009-11-27T07:38:08Z</dc:date>
    </item>
    <item>
      <title>SQL syntax - Help</title>
      <link>https://community.qlik.com/t5/QlikView/SQL-syntax-Help/m-p/167310#M38919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;take @vmonth as varchar and @vyear as char(04)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Nov 2009 11:54:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SQL-syntax-Help/m-p/167310#M38919</guid>
      <dc:creator />
      <dc:date>2009-11-27T11:54:28Z</dc:date>
    </item>
  </channel>
</rss>

