<?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>Web Development - Web Development Tutorial for Developer&#039;s, Asp.net Tutorial, PHP Development, Wordpress Integration &#187; Database</title>
	<atom:link href="http://www.solutions4ever.net/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.solutions4ever.net</link>
	<description>Web Development Solutions Provider</description>
	<lastBuildDate>Fri, 03 Sep 2010 11:45:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Transact-SQL: Renaming a Column</title>
		<link>http://www.solutions4ever.net/2010/07/transact-sql-renaming-a-column/</link>
		<comments>http://www.solutions4ever.net/2010/07/transact-sql-renaming-a-column/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 10:50:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/2010/07/transact-sql-renaming-a-column/</guid>
		<description><![CDATA[<p>To rename a column, first open an empty query window. In a query window, execute sp_rename using the following formula:</p>
sp_rename 'TableName.ColumnName', 'NewColumnName', 'COLUMN'
<p>The sp_rename factor and the &#8216;COLUMN&#8217; string are required. The TableName factor is the name of the table that the column belongs to. The ColumnName is the current  ... <a href="http://www.solutions4ever.net/2010/07/transact-sql-renaming-a-column/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<p>To rename a column, first open an empty query window. In a query window, execute <strong>sp_rename</strong> using the following formula:</p>
<pre><span style="color: #ff0000;">sp_rename</span> '<em>TableName</em>.<em>ColumnName</em>', '<em>NewColumnName</em>', <span style="color: #ff0000;">'COLUMN'</span></pre>
<p>The <strong>sp_rename</strong> factor and the <strong>&#8216;COLUMN&#8217;</strong> string are required. The <em>TableName</em> factor is the name of the table that the column belongs to. The <em>ColumnName</em> is the current name of the column. The <em>NewColumnName</em> is the desired name you want to give to the column.</p>
<p>Here is an example:</p>
<pre>sp_rename 'StaffMembers.FullName', 'EmployeeName', 'COLUMN'
GO</pre>
<p>When this code is executed, the interpreter will look for a column named FullName in the StaffMembers table of the current or selected <span style="color: #0000ff;">database</span>. If it finds that column in the table, then it renames it EmployeeName.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/07/transact-sql-renaming-a-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transact-SQL: Deleting a Column</title>
		<link>http://www.solutions4ever.net/2010/07/transact-sql-deleting-a-column/</link>
		<comments>http://www.solutions4ever.net/2010/07/transact-sql-deleting-a-column/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 10:48:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/?p=194</guid>
		<description><![CDATA[<p>To delete a column using code, first open or access an empty query window, and use the following syntax:</p>
ALTER TABLE TableName
DROP COLUMN ColumnName
<p>On the right side of the ALTER TABLE expression, type the name of the table. On the right side of the DROP COLUMN expression, enter the name of  ... <a href="http://www.solutions4ever.net/2010/07/transact-sql-deleting-a-column/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<p>To delete a column using code, first open or access an empty query window, and use the following syntax:</p>
<pre>ALTER TABLE <em>TableName</em>
DROP COLUMN <em>ColumnName</em></pre>
<p>On the right side of the <strong>ALTER TABLE</strong> expression, type the name of the table. On the right side of the <strong>DROP COLUMN</strong> expression, enter the name of the undesired column. Here is an example:</p>
<pre>ALTER TABLE Members
DROP COLUMN CurrentResidence;
GO</pre>
<p>When this code is executed, the interpreter will look for a column named CurrentResidence in a table named Members of the current or selected database. If it finds that column, it will remove it from the table.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/07/transact-sql-deleting-a-column/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An Identity Column</title>
		<link>http://www.solutions4ever.net/2010/07/an-identity-column/</link>
		<comments>http://www.solutions4ever.net/2010/07/an-identity-column/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 10:45:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/?p=192</guid>
		<description><![CDATA[<p>An identity column is one whose value is automatically created by the database engine when a new record is added. This makes sure that each record has a unique value for that field.</p>
<p>To create an identity column in Transact-SQL, after the name and data type of the column, type identity  ... <a href="http://www.solutions4ever.net/2010/07/an-identity-column/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<p>An identity column is one whose value is automatically created by the database engine when a new record is added. This makes sure that each record has a unique value for that field.</p>
<p>To create an identity column in Transact-SQL, after the name and data type of the column, type <strong>identity</strong> followed by parentheses. Between the parentheses, enter the seed value, followed by a comma, followed by the increment value. Here is an example:</p>
<pre>CREATE TABLE Store(
    ItemID int <span style="color: #ff0000;">IDENTITY(1, 1)</span> NOT NULL,
    Category nvarchar(50),
    ItemName nvarchar(100) NOT NULL,
    Size nvarchar(20),
    UnitPrice money);
GO</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/07/an-identity-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transact-SQL: Adding a Column to a Table</title>
		<link>http://www.solutions4ever.net/2010/07/transact-sql-adding-a-column-to-a-table/</link>
		<comments>http://www.solutions4ever.net/2010/07/transact-sql-adding-a-column-to-a-table/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 10:41:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/?p=190</guid>
		<description><![CDATA[<p> </p>
<p>To add a new column to a table, follow this syntax:</p>
ALTER TABLE TableName
ADD ColumnName Properties
<p>Here is an example:</p>
ALTER TABLE Members
ADD Address varchar(100) NULL
GO
<p>When above code is executed, a new column named Address, of type varchar, with a limit of 100 characters, and that allows empty entries, would be added to the  ... <a href="http://www.solutions4ever.net/2010/07/transact-sql-adding-a-column-to-a-table/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>To add a new column to a table, follow this syntax:</p>
<pre>ALTER TABLE <em>TableName</em>
ADD <em>ColumnName Properties</em></pre>
<p>Here is an example:</p>
<pre>ALTER TABLE Members
ADD Address varchar(100) NULL
GO</pre>
<p>When above code is executed, a new column named Address, of type <strong>varchar</strong>, with a limit of 100 characters, and that allows empty entries, would be added to the table named Members.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/07/transact-sql-adding-a-column-to-a-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Expressions/Examples</title>
		<link>http://www.solutions4ever.net/2010/06/sql-expressionsexamples/</link>
		<comments>http://www.solutions4ever.net/2010/06/sql-expressionsexamples/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 08:01:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/?p=187</guid>
		<description><![CDATA[Creating a Database
<p>To create a database in SQL, use the following syntax:</p>
CREATE DATABASE DatabaseName
<p>Here is an example:</p>
CREATE DATABASE BethesdaCarRental;
Deleting a Database
<p>To delete a database, you use the DROP DATABASE expression followed by the name of the database. The formula used is:</p>
DROP DATABASE DatabaseName;
<p>Here is an example:</p>
DROP DATABASE RealEstate1;
GO

Renaming a Database

<p>To  ... <a href="http://www.solutions4ever.net/2010/06/sql-expressionsexamples/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<h2><strong>Creating a Database</strong></h2>
<p>To create a database in SQL, use the following syntax:</p>
<pre>CREATE DATABASE <em>DatabaseName</em></pre>
<p>Here is an example:</p>
<pre>CREATE DATABASE BethesdaCarRental;</pre>
<h2><strong>Deleting a Database</strong></h2>
<p>To delete a database, you use the <strong>DROP DATABASE</strong> expression followed by the name of the database. The formula used is:</p>
<pre>DROP DATABASE <em>DatabaseName;</em></pre>
<p>Here is an example:</p>
<pre>DROP DATABASE RealEstate1;</pre>
<pre>GO<strong>
</strong></pre>
<h2><strong>Renaming a Database<br />
</strong></h2>
<p>To change the name of a database  , Transact-SQL provides <strong>sp_renamedb</strong>. The formula used would be:</p>
<p>EXEC sp_renamedb &#8216;<em>ExistingName</em>&#8216;, &#8216;<em>NewName&#8217;</em></p>
<p>The <strong>EXEC sp_renamedb</strong> expression is required.</p>
<p>The <em>ExistingName</em> factor is the name of the database that you want to rename.</p>
<p>The <em>NewName</em> factor is the name you want the database to have after renaming it.</p>
<p>Here is an example of renaming a database:</p>
<pre>EXEC sp_renamedb 'RentalCars', 'BethesdaCarRental</pre>
<pre>GO</pre>
<h2><strong>Creating a Table</strong></h2>
<p>To create a table, you can follow this syntax:</p>
<pre>CREATE TABLE Country(<em>Column1</em>, <em>Column2</em>, <em>Column3</em>)</pre>
<p>or:</p>
<pre>CREATE TABLE Country(</pre>
<pre><em>Column1</em>,</pre>
<pre><em>Column2</em>,</pre>
<pre><em>Column3</em>);</pre>
<p>Each column is created as:</p>
<pre><em>ColumnName</em> <em>DataType</em> <em>Options</em></pre>
<p>Here is an example:</p>
<pre>CREATE TABLE Customers (</pre>
<pre>               DrvLicNbr nvarchar(32),</pre>
<pre>               DateIssued DATE,</pre>
<pre>               DateExpired date,</pre>
<pre>               FullName nvarchar(50),</pre>
<pre>               Address NVARCHAR(120),</pre>
<pre>               City NvarChar(40),</pre>
<pre>               State NVarChar(50),</pre>
<pre>               PostalCode nvarchar(20),</pre>
<pre>               HomePhone nvarchar(20),</pre>
<pre>               OrganDonor BIT);</pre>
<pre>GO</pre>
<p><strong> </strong></p>
<h2><strong>Deleting a Table</strong></h2>
<p>To delete a table using SQL, use the following syntax:</p>
<pre>DROP TABLE <em>TableName</em></pre>
<p>The <strong>DROP TABLE</strong> expression is required and it is followed by the name of the undesired table. Here is an example:</p>
<pre>DROP TABLE Students;</pre>
<pre>GO</pre>
<h2><strong>Renaming a Table</strong></h2>
<p>To rename a table using code, execute the <strong>sp_rename</strong> stored procedure using the following syntax:</p>
<pre>sp_rename <em>ExistingTableName</em>, <em>TableNewName</em>;</pre>
<p>Here is an example:</p>
<pre>sp_rename 'StaffMembers', 'Employees';</pre>
<pre>GO</pre>
<h2><strong>Creating a View</strong></h2>
<p>To programmatically create a view, you use the following SQL syntax:</p>
<pre>CREATE VIEW <em>ViewName</em></pre>
<pre>AS</pre>
<pre>SELECT <em>Statement</em></pre>
<p><strong> </strong></p>
<p><strong>Example:</strong></p>
<p><strong> </strong></p>
<pre>CREATE VIEW dbo.ListOfMen</pre>
<pre>AS</pre>
<pre>SELECT dbo.Genders.Gender,</pre>
<pre>       dbo.Persons.FirstName, dbo.Persons.LastName</pre>
<pre>FROM   dbo.Genders INNER JOIN dbo.Persons</pre>
<pre>ON     dbo.Genders.GenderID = dbo.Persons.GenderID</pre>
<pre>WHERE  (dbo.Genders.Gender = N'Male');</pre>
<pre>GO</pre>
<p><strong> </strong></p>
<h2><strong>Modifying a View</strong></h2>
<p><strong> </strong></p>
<pre>ALTER VIEW <em>ViewName</em></pre>
<pre>AS</pre>
<pre>SELECT <em>Statement</em></pre>
<pre><strong>Example:
</strong></pre>
<pre>ALTER VIEW dbo.ListOfMen</pre>
<pre>AS</pre>
<pre>SELECT dbo.Persons.FirstName, dbo.Persons.LastName</pre>
<pre>FROM   dbo.Genders INNER JOIN dbo.Persons</pre>
<pre>ON     dbo.Genders.GenderID = dbo.Persons.GenderID</pre>
<pre>WHERE  (dbo.Genders.Gender = N'Male');</pre>
<h2><strong>Deleting a View</strong></h2>
<pre>DROP VIEW <em>ViewName</em></pre>
<pre><strong>Example:</strong></pre>
<pre>DROP VIEW dbo.ListOfMen</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/06/sql-expressionsexamples/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Count number of words in a MySQL column</title>
		<link>http://www.solutions4ever.net/2010/03/count-number-of-words-in-a-mysql-column/</link>
		<comments>http://www.solutions4ever.net/2010/03/count-number-of-words-in-a-mysql-column/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 08:02:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/?p=157</guid>
		<description><![CDATA[<p>This is a general requirement to count number of words in a column of a MySQL database table. But MySQL does not have any built in function to count number of words as it generally has for number of purposes.</p>
<p>But you can do it with a simple trick e.g. you  ... <a href="http://www.solutions4ever.net/2010/03/count-number-of-words-in-a-mysql-column/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<p>This is a general requirement to count number of words in a column of a MySQL database table. But MySQL does not have any built in function to count number of words as it generally has for number of purposes.</p>
<p>But you can do it with a simple trick e.g. you have a column name and want to count number of words in it. This query will return number of words separated with space in a column</p>
<p><span style="color: #800000;">SELECT SUM( LENGTH(name) &#8211; LENGTH(REPLACE(name, &#8216; &#8216;, &#8221;))+1) FROM table</span></p>
<p><span style="color: #000000;">If you want to count number of words separated by some other string for example comma (,) or semicolon (;), simply replace <em>space</em> with your required character.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/03/count-number-of-words-in-a-mysql-column/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Bind multiple rows value in a single row</title>
		<link>http://www.solutions4ever.net/2010/02/bind-multiple-rows-value-in-a-single-row/</link>
		<comments>http://www.solutions4ever.net/2010/02/bind-multiple-rows-value-in-a-single-row/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 09:36:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/2010/02/bind-multiple-rows-value-in-a-single-row/</guid>
		<description><![CDATA[Following example demonstrate that how you can bind multiple rows value in a single row. Through this query you got comma (,) separated value in a single row.   
 
 
Example:- 
 
declare @a varchar(500)
set @a = &#8216; &#8216;
select @a = @a + cast(id as varchar(20)) + &#8216;,&#8217; from dbo.TR_UserBasic
if len(@a)&#62;1
set @a= left(@a,len(@a)-1)
select case  ... <a href="http://www.solutions4ever.net/2010/02/bind-multiple-rows-value-in-a-single-row/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<div>Following example demonstrate that how you can bind multiple rows value in a single row. Through this query you got comma (,) separated value in a single row.   </div>
<div> </div>
<div> </div>
<div><strong>Example:- </strong></div>
<div> </div>
<div>declare @a varchar(500)</div>
<div>set @a = &#8216; &#8216;</div>
<div>select @a = @a + cast(id as varchar(20)) + &#8216;,&#8217; from dbo.TR_UserBasic</div>
<div>if len(@a)&gt;1</div>
<div>set @a= left(@a,len(@a)-1)</div>
<div>select case @a when &#8221; then &#8216;0&#8242; else @a end as id</div>
<div> </div>
<div> </div>
<div><strong>Out Put- </strong>110,111,112,113,130,93,104,95,96,97,98,99,100,101,102,103</div>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/02/bind-multiple-rows-value-in-a-single-row/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How execute store procedure with C#.net</title>
		<link>http://www.solutions4ever.net/2010/02/how-execute-store-procedure-with-c-net/</link>
		<comments>http://www.solutions4ever.net/2010/02/how-execute-store-procedure-with-c-net/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 09:35:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/?p=114</guid>
		<description><![CDATA[<p>Create store procedure in sql query analyser</p>
<p>CREATE PROCEDURE sp_chkadmin
@login_id varchar(50),
@password varchar(50)
as begin
select * from where login_id = @login_id and password =@password
end</p>
<p>GO</p>
<p>protected void butlogin_ServerClick1(object sender, EventArgs e)
{</p>
<p>string username = txtlogin.Value.ToString().Replace(&#8220;&#8216;&#8221;, &#8220;&#8221;&#8221;);
string password = txtpassword.Value.ToString().Replace(&#8220;&#8216;&#8221;, &#8220;&#8221;&#8221;);
int isUserExist=0;
isUserExist = IsUserExist(username, password);
if (isUserExist == 1)
{
Session["admin"] = username;
Response.Redirect(&#8220;next.aspx&#8221;);
}
else
{
lblhead.Text = &#8220;Please Enter Correct Username or Password  ... <a href="http://www.solutions4ever.net/2010/02/how-execute-store-procedure-with-c-net/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small;">Create store procedure in sql query analyser</p>
<p>CREATE PROCEDURE sp_chkadmin</span><br />
<span style="font-size: small;">@login_id varchar(50),</span><br />
<span style="font-size: small;">@password varchar(50)</span><br />
<span style="font-size: small;">as begin</span><br />
<span style="font-size: small;">select * from where login_id = @login_id and password =@password</span><br />
<span style="font-size: small;">end</span></p>
<p><span style="font-size: small;">GO</p>
<p></span><span style="font-size: small;">protected void butlogin_ServerClick1(object sender, EventArgs e)<br />
{</p>
<p>string username = txtlogin.Value.ToString().Replace(&#8220;&#8216;&#8221;, &#8220;&#8221;&#8221;);<br />
string password = txtpassword.Value.ToString().Replace(&#8220;&#8216;&#8221;, &#8220;&#8221;&#8221;);<br />
int isUserExist=0;<br />
isUserExist = IsUserExist(username, password);<br />
if (isUserExist == 1)<br />
{<br />
Session["admin"] = username;<br />
Response.Redirect(&#8220;next.aspx&#8221;);<br />
}<br />
else<br />
{<br />
lblhead.Text = &#8220;Please Enter Correct Username or Password !&#8221;;<br />
lblhead.Visible = true;<br />
}</p>
<p>}</p>
<p>public int IsUserExist(string id,string pass)<br />
{<br />
string CONN_STRING = System.Configuration.ConfigurationSettings.AppSettings["urlString"]<br />
.ToString();//&#8221;provider=sqloledb;server=aaa;uid=aa;pwd=aa;&#8221;;<br />
SqlConnection conn = new SqlConnection(CONN_STRING);<br />
SqlCommand cmd = new SqlCommand();<br />
SqlDataAdapter da = new SqlDataAdapter();<br />
DataSet ds =new DataSet() ;</p>
<p>int iRows = 0;<br />
try<br />
{<br />
cmd.Connection = conn;<br />
if (conn.State == ConnectionState.Closed) conn.Open();<br />
// conn.Open();<br />
cmd.Parameters.Clear();</p>
<p>cmd.CommandType = CommandType.StoredProcedure;<br />
cmd.CommandText = &#8220;sp_chkadmin&#8221;;</p>
<p>cmd.Parameters.Add(new SqlParameter(&#8220;@login_id&#8221;, SqlDbType.VarChar));<br />
cmd.Parameters["@login_id"].Value = id;</p>
<p>cmd.Parameters.Add(new SqlParameter(&#8220;@password&#8221;, SqlDbType.VarChar));<br />
cmd.Parameters["@password"].Value = pass;</p>
<p>da.SelectCommand = cmd;<br />
iRows = Convert.ToInt32(cmd.ExecuteScalar());<br />
}<br />
catch (Exception ex)<br />
{</p>
<p>}<br />
finally<br />
{<br />
if (conn.State == ConnectionState.Open) conn.Close();<br />
}<br />
return iRows;<br />
} </span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/02/how-execute-store-procedure-with-c-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How use trigger in sql</title>
		<link>http://www.solutions4ever.net/2010/02/how-use-trigger-in-sql/</link>
		<comments>http://www.solutions4ever.net/2010/02/how-use-trigger-in-sql/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 09:34:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/?p=112</guid>
		<description><![CDATA[<p>Example of Delete trigger</p>
<p>CREATE trigger [TRIGGER_Deletesubcategory] ON dbo.category</p>
<p>FOR delete</p>
<p>AS</p>
<p>declare @nmid int</p>
<p>select @nmid=sno from deleted</p>
<p>delete from subcategory where cat_id= @nmid</p>
<p>There will be two table one is category and second one is subcategory and the primery key of category table will be sno and the this will foreign key(cat_id) for subcategory table.</p>
]]></description>
			<content:encoded><![CDATA[<p>Example of Delete trigger</p>
<p>CREATE trigger [TRIGGER_Deletesubcategory] ON dbo.category</p>
<p>FOR delete</p>
<p>AS</p>
<p>declare @nmid int</p>
<p>select @nmid=sno from deleted</p>
<p>delete from subcategory where cat_id= @nmid</p>
<p>There will be two table one is category and second one is subcategory and the primery key of category table will be sno and the this will foreign key(cat_id) for subcategory table.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/02/how-use-trigger-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Return Multi Row value in a single column with comma seprated</title>
		<link>http://www.solutions4ever.net/2010/02/return-multi-row-value-in-a-single-column-with-comma-seprated/</link>
		<comments>http://www.solutions4ever.net/2010/02/return-multi-row-value-in-a-single-column-with-comma-seprated/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 09:33:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://www.solutions4ever.net/?p=110</guid>
		<description><![CDATA[<p>Return Multi Row value in a single column with comma seprated using sql
I want Return output like 1,2,3,4,5 using sql.
There is one table in which has column
id name
1 Dilip
2 Dinesh
3 Varun
4 Dhanpat
5 Renuka</p>
<p>solution:
declare @a varchar(500)
set @a = &#8216; &#8216;
select @a = @a + cast(id as varchar(20)) + &#8216;,&#8217; from tablename
if  ... <a href="http://www.solutions4ever.net/2010/02/return-multi-row-value-in-a-single-column-with-comma-seprated/" class="expert-read-more" >Read More</a>]]></description>
			<content:encoded><![CDATA[<p>Return Multi Row value in a single column with comma seprated using sql<br />
I want Return output like 1,2,3,4,5 using sql.<br />
There is one table in which has column<br />
id name<br />
1 Dilip<br />
2 Dinesh<br />
3 Varun<br />
4 Dhanpat<br />
5 Renuka</p>
<p>solution:<br />
declare @a varchar(500)<br />
set @a = &#8216; &#8216;<br />
select @a = @a + cast(id as varchar(20)) + &#8216;,&#8217; from tablename<br />
if len(@a)&gt;1<br />
set @a= left(@a,len(@a)-1)<br />
select case @a when &#8221; then &#8216;0&#8242; else @a end as id</p>
<p>Use case , becaue may be there is no any value in this table so it will retun o</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutions4ever.net/2010/02/return-multi-row-value-in-a-single-column-with-comma-seprated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
