<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Puzzle &#8211; Solution &#8211; Computed Columns Datatype Explanation</title>
	<atom:link href="http://blog.sqlauthority.com/2008/09/29/sql-server-puzzle-solution-computed-columns-datatype-explanation/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/09/29/sql-server-puzzle-solution-computed-columns-datatype-explanation/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Afodunrinbi Lanre</title>
		<link>http://blog.sqlauthority.com/2008/09/29/sql-server-puzzle-solution-computed-columns-datatype-explanation/#comment-415658</link>
		<dc:creator><![CDATA[Afodunrinbi Lanre]]></dc:creator>
		<pubDate>Thu, 31 Jan 2013 07:05:03 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1326#comment-415658</guid>
		<description><![CDATA[you cannot alter a computed column , you need to drop and add the column again

Alter table table1
drop column computedcolumn

Alter table table1
Add computedcolumn As (column1+column2)]]></description>
		<content:encoded><![CDATA[<p>you cannot alter a computed column , you need to drop and add the column again</p>
<p>Alter table table1<br />
drop column computedcolumn</p>
<p>Alter table table1<br />
Add computedcolumn As (column1+column2)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Santosh S.Pawar</title>
		<link>http://blog.sqlauthority.com/2008/09/29/sql-server-puzzle-solution-computed-columns-datatype-explanation/#comment-392972</link>
		<dc:creator><![CDATA[Santosh S.Pawar]]></dc:creator>
		<pubDate>Fri, 14 Dec 2012 06:28:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1326#comment-392972</guid>
		<description><![CDATA[How to alter computed column. i have tried with alter command but it giving error. already i Have one computed column like..  total_amt as [qty]*[charges].
Now i want to change this columns as.. total_amt as [charges]]]></description>
		<content:encoded><![CDATA[<p>How to alter computed column. i have tried with alter command but it giving error. already i Have one computed column like..  total_amt as [qty]*[charges].<br />
Now i want to change this columns as.. total_amt as [charges]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - 2008 - TRIM() Function - User Defined Function Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2008/09/29/sql-server-puzzle-solution-computed-columns-datatype-explanation/#comment-47510</link>
		<dc:creator><![CDATA[SQL SERVER - 2008 - TRIM() Function - User Defined Function Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Thu, 26 Feb 2009 12:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1326#comment-47510</guid>
		<description><![CDATA[[...] I have created following UDF which everyday when I have to TRIM() any word or column. CREATE FUNCTION dbo.TRIM(@string VARCHAR(MAX)) RETURNS VARCHAR(MAX) BEGIN RETURN LTRIM(RTRIM(@string)) END GO  Now let us test above UDF running following statement where there are leading and trailing spaces around word. SELECT dbo.TRIM(&#8216; leading trailing &#8216;) It will return string in result window as &#8216;leading trailing&#8217; There will be no spaces around them. If extra spaces are useless data, when data is inserted in database they should be trimmed. If there is need of spaces in data but in certain cases they should be trimmed when retrieving we can use Computed Columns. Read more about computed columns SQL SERVER - Puzzle - Solution - Computed Columns Datatype Explanation. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] I have created following UDF which everyday when I have to TRIM() any word or column. CREATE FUNCTION dbo.TRIM(@string VARCHAR(MAX)) RETURNS VARCHAR(MAX) BEGIN RETURN LTRIM(RTRIM(@string)) END GO  Now let us test above UDF running following statement where there are leading and trailing spaces around word. SELECT dbo.TRIM(&#8216; leading trailing &#8216;) It will return string in result window as &#8216;leading trailing&#8217; There will be no spaces around them. If extra spaces are useless data, when data is inserted in database they should be trimmed. If there is need of spaces in data but in certain cases they should be trimmed when retrieving we can use Computed Columns. Read more about computed columns SQL SERVER &#8211; Puzzle &#8211; Solution &#8211; Computed Columns Datatype Explanation. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: willspurgeon</title>
		<link>http://blog.sqlauthority.com/2008/09/29/sql-server-puzzle-solution-computed-columns-datatype-explanation/#comment-44287</link>
		<dc:creator><![CDATA[willspurgeon]]></dc:creator>
		<pubDate>Wed, 19 Nov 2008 17:31:03 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1326#comment-44287</guid>
		<description><![CDATA[In some cases you can also just cast the entire result as part of your calculation, for instance if you need to stay under the 28 decimal limit present in .Net but your computed column is sometimes coming out to more than 28:

--Example showing computation resulting in a field length of 30

CREATE TABLE #MyTable
(
ID TINYINT NOT NULL IDENTITY (1, 1),
FirstCol numeric(18,6) NOT NULL,
SecondCol numeric(18,6) NOT NULL,
ComputedCol AS (FirstCol/SecondCol)
) ON [PRIMARY]
GO
INSERT INTO #MyTable
([FirstCol],[SecondCol])
VALUES (100000000,0.75)
GO
SELECT *, len(ComputedCol) as Length
FROM #MyTable

--Fixed to only be a field length of 16
drop table #MyTable

CREATE TABLE #MyTable
(
ID TINYINT NOT NULL IDENTITY (1, 1),
FirstCol numeric(18,6) NOT NULL,
SecondCol numeric(18,6) NOT NULL,
ComputedCol AS cast((FirstCol/SecondCol) as numeric(18,6))
) ON [PRIMARY]
GO
INSERT INTO #MyTable
([FirstCol],[SecondCol])
VALUES (100000000,0.75)
GO
SELECT *, len(ComputedCol) as Length
FROM #MyTable]]></description>
		<content:encoded><![CDATA[<p>In some cases you can also just cast the entire result as part of your calculation, for instance if you need to stay under the 28 decimal limit present in .Net but your computed column is sometimes coming out to more than 28:</p>
<p>&#8211;Example showing computation resulting in a field length of 30</p>
<p>CREATE TABLE #MyTable<br />
(<br />
ID TINYINT NOT NULL IDENTITY (1, 1),<br />
FirstCol numeric(18,6) NOT NULL,<br />
SecondCol numeric(18,6) NOT NULL,<br />
ComputedCol AS (FirstCol/SecondCol)<br />
) ON [PRIMARY]<br />
GO<br />
INSERT INTO #MyTable<br />
([FirstCol],[SecondCol])<br />
VALUES (100000000,0.75)<br />
GO<br />
SELECT *, len(ComputedCol) as Length<br />
FROM #MyTable</p>
<p>&#8211;Fixed to only be a field length of 16<br />
drop table #MyTable</p>
<p>CREATE TABLE #MyTable<br />
(<br />
ID TINYINT NOT NULL IDENTITY (1, 1),<br />
FirstCol numeric(18,6) NOT NULL,<br />
SecondCol numeric(18,6) NOT NULL,<br />
ComputedCol AS cast((FirstCol/SecondCol) as numeric(18,6))<br />
) ON [PRIMARY]<br />
GO<br />
INSERT INTO #MyTable<br />
([FirstCol],[SecondCol])<br />
VALUES (100000000,0.75)<br />
GO<br />
SELECT *, len(ComputedCol) as Length<br />
FROM #MyTable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: santosh</title>
		<link>http://blog.sqlauthority.com/2008/09/29/sql-server-puzzle-solution-computed-columns-datatype-explanation/#comment-43419</link>
		<dc:creator><![CDATA[santosh]]></dc:creator>
		<pubDate>Wed, 01 Oct 2008 06:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1326#comment-43419</guid>
		<description><![CDATA[sir , I want to know whether i can pass parameter from two different table for a computed column .
if yes any clue.
no then what is the alternate to calculate the value for a column which depends on other table column witout any user interaction]]></description>
		<content:encoded><![CDATA[<p>sir , I want to know whether i can pass parameter from two different table for a computed column .<br />
if yes any clue.<br />
no then what is the alternate to calculate the value for a column which depends on other table column witout any user interaction</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - Puzzle - Computed Columns Datatype Explanation Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2008/09/29/sql-server-puzzle-solution-computed-columns-datatype-explanation/#comment-43352</link>
		<dc:creator><![CDATA[SQL SERVER - Puzzle - Computed Columns Datatype Explanation Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Mon, 29 Sep 2008 05:43:05 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1326#comment-43352</guid>
		<description><![CDATA[[...] UPDATE : Solution to Puzzle - SQL SERVER - Puzzle - Solution - Computed Columns Datatype Explanation [...]]]></description>
		<content:encoded><![CDATA[<p>[...] UPDATE : Solution to Puzzle &#8211; SQL SERVER &#8211; Puzzle &#8211; Solution &#8211; Computed Columns Datatype Explanation [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
