<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: SQL Server view column conversion problem</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/sql-server-view-column-conversion-problem/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-view-column-conversion-problem/</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jun 2013 11:35:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: The Most-Watched IT Questions: July 20, 2010 - ITKE Community Blog</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-view-column-conversion-problem/#comment-79388</link>
		<dc:creator>The Most-Watched IT Questions: July 20, 2010 - ITKE Community Blog</dc:creator>
		<pubDate>Tue, 20 Jul 2010 06:38:13 +0000</pubDate>
		<guid isPermaLink="false">#comment-79388</guid>
		<description><![CDATA[[...] Rmb1981 was having a SQL Server view column conversion problem and Mr. Denny and Carlosdl tried to help him [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Rmb1981 was having a SQL Server view column conversion problem and Mr. Denny and Carlosdl tried to help him [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-view-column-conversion-problem/#comment-78953</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Wed, 07 Jul 2010 14:20:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-78953</guid>
		<description><![CDATA[Ok, I use SQL Server just for testing, so my knowledge is limited.

I made a simplified test, and got no errors:

&lt;pre&gt;CREATE TABLE test_table (
v_swid&lt;b&gt; VARCHAR(20)&lt;/b&gt;,
i_other_column INTEGER)

INSERT INTO test_table VALUES (&#039;1&#039;,1);
INSERT INTO test_table VALUES (&#039;2&#039;,2);
INSERT INTO test_table VALUES (&#039;&lt;b&gt;CITY&lt;/b&gt;&#039;,10);
INSERT INTO test_table VALUES (&#039;11&#039;,11);
INSERT INTO test_table VALUES (&#039;&lt;b&gt;CITY&lt;/b&gt;&#039;,20);
INSERT INTO test_table VALUES (&#039;21&#039;,21);

CREATE VIEW v_test AS
SELECT &lt;b&gt;CAST(v_swid AS INTEGER) swid&lt;/b&gt;, i_other_column
FROM test_table
&lt;b&gt;WHERE v_swid != &#039;CITY&lt;/b&gt;&#039;;

SELECT * FROM v_test;

(4 row(s) affected)

&lt;b&gt;SELECT * FROM v_test WHERE swid = 11;

(1 row(s) affected)&lt;/b&gt;&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Ok, I use SQL Server just for testing, so my knowledge is limited.</p>
<p>I made a simplified test, and got no errors:</p>
<pre>CREATE TABLE test_table (
v_swid<b> VARCHAR(20)</b>,
i_other_column INTEGER)

INSERT INTO test_table VALUES ('1',1);
INSERT INTO test_table VALUES ('2',2);
INSERT INTO test_table VALUES ('<b>CITY</b>',10);
INSERT INTO test_table VALUES ('11',11);
INSERT INTO test_table VALUES ('<b>CITY</b>',20);
INSERT INTO test_table VALUES ('21',21);

CREATE VIEW v_test AS
SELECT <b>CAST(v_swid AS INTEGER) swid</b>, i_other_column
FROM test_table
<b>WHERE v_swid != 'CITY</b>';

SELECT * FROM v_test;

(4 row(s) affected)

<b>SELECT * FROM v_test WHERE swid = 11;

(1 row(s) affected)</b></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/sql-server-view-column-conversion-problem/#comment-78921</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Tue, 06 Jul 2010 19:08:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-78921</guid>
		<description><![CDATA[It could be just a typo, but you said the source column was varchar, but the error message says &quot;...when converting the &lt;b&gt;nvarchar &lt;/b&gt;value ...&quot; 

If the records with non-numeric data were filtered out when creating the view and the column was in fact cast to a numberic data type, you should not get errors when querying the view using an integer as criteria.

Can you post the view creation command  and the complete query that is giving the error ?]]></description>
		<content:encoded><![CDATA[<p>It could be just a typo, but you said the source column was varchar, but the error message says &#8220;&#8230;when converting the <b>nvarchar </b>value &#8230;&#8221; </p>
<p>If the records with non-numeric data were filtered out when creating the view and the column was in fact cast to a numberic data type, you should not get errors when querying the view using an integer as criteria.</p>
<p>Can you post the view creation command  and the complete query that is giving the error ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.013 seconds using memcached
Object Caching 296/299 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-06-19 12:40:30 -->