November 4, 2016 11:25 by Dan
Based on ASP.NET Corner blog. I have two columns Name and Age in my Table(MyTable). From the MyTable I want to delete only duplicate records. So the below Query will help you to delete or remove the duplicate rows from the MyTable.
Below is MyTable output:
SELECT * FROM MyTable
Remove duplicate rows from the table:
The below query will help you to delete duplicate row from your table. Here we used Row_Number() function and PARTITION BY key words to remove the duplicate rows.
DELETE SUB FROM
(SELECT ROW_NUMBER() OVER (PARTITION BY Name, Age ORDER BY Name) cnt
FROM MyTable) SUB
WHERE SUB.Cnt > 1
After the query execution the output is:
How to use Row_Number in SQL Select query:
SELECT ROW_NUMBER() OVER(ORDER BY Age) FROM mytable
Best ASP.NET Hosting Recommendation
ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice
September 28, 2015 06:02 by Dan
Today, we will explain about SQL Split Function to Split an Input String. Generally when posting an article in a blog, we have to define tags (Like C#.NET, AJAX, ASP.NET,HTML) upon the article. We usually take these tags in a TextBox with separated them by comma(,). To insert these into database we have two ways to do.
First Method using C# :
Using C# you can split the TextBox items and use a for loop to insert into the database. Code is as follow.
string tags = txtTags.Text.<span class="IL_AD" id="IL_AD10">Trim</span>().Split(',');
/* With for loop */
for (int i=0;i<tags.Count ;i++)
/* perform db query with tags[i].ToSting();
/* with foreach */
foreach (string i in tags)
/* perform db query with i.ToSting();
Second SQL Method :
Here in the SQL we pass the whole items of TextBox into SQL function to split it and then insert these into specific table. Lets see how to do this.
CREATE FUNCTION SplitText
RETURNS @Output TABLE (
DECLARE @StartIndex INT, @EndIndex INT
SET @StartIndex = 1
IF SUBSTRING(@Input, LEN(@Input) - 1, LEN(@Input)) <> @Character
SET @Input = @Input + @Character
WHILE CHARINDEX(@Character, @Input) > 0
SET @EndIndex = CHARINDEX(@Character, @Input)
INSERT INTO @Output(Item)
<span class="IL_AD" id="IL_AD12">SELECT</span> SUBSTRING(@Input, @StartIndex, @EndIndex - 1)
SET @Input = SUBSTRING(@Input, @EndIndex + 1, LEN(@Input))
-- Create a temporary table to insert tags
Id identity (1,1),
-- Inserting into tmpTable
insert into #tblTemp (temp) values
-- Seperated by Comma(,). Place any thing according to you.
Execute your SQL batch query to inserting the tags into table.
Best ASP.NET 4.6 Hosting Recommendation
ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.
April 8, 2014 08:00 by Ben
ASPHostPortal.com, a reliable web hosting company specializing in ASP.NET hosting services, announces the deployment of SQL Server 2014 in its web hosting packages.
ASPHostPortal.com now provides the SQL Server 2014 in all of web hosting packages, assisting all their web hosting customers on organizing, improving and securing business’ data. Making business decisions are the crucial steps that businesses need to take, mostly in short time. It requires accessing company’s data in easy manner to be analyzed and evaluated. The SQL Server 2014 has the excellent tool to do this. With the Power View, businesses will be able to excerpt data into PowerPoint presentations and bring updated information in every meeting.
Businesses are often must face complicated issues, whether it occurs inside the organization or related to clients and customers. For example, clients often want their data quality being improved regularly that can be a challenging task. With the SQL Server 2014 this process can be reduced this problem since it has the ability to enhance the consistency and accuracy of the data. The SQL Server 2014 works by cleaning out the data thus resulting in superior quality and enduring maintenance.
The basic shared hosting service is supported by SQL Server 2014 web hosting and the site provides this plan at a monthly cost of $5. The site assures a 24x7 customer support service and guarantees a 99.9% uptime as they have installed fully servers. The company through its website gives all its customers a Plesk Panel which is basically server management software.
“Our customers have been asking us about SQL Server 2014 and we are happy to deliver a hosting platform that supports all the latest in the Microsoft Web Stack.” said said Dean Thomas, Manager at ASPHostPortal.com. "And it proves that we remain at the forefront in Microsoft technology".
ASPHostPortal.com is a popular SQL Server 2014 hosting service provider with all of its hosting plans to help users to automate and simplify website and server administration tasks such as installation and migration. For more information about this topics or have any enquiries related to SQL Server 2014 hosting, please visit http://asphostportal.com/SQL-2014-Hosting.
ASPHostPortal.com is now providing this FREE DOMAIN and DOUBLE SQL Space promotion link for new clients to enjoy the company's outstanding web hosting service at a low cost from just $5.00/mo. This offer valids only from 21st March 2014 to 20 April 2014 and it applies to all the new clients registered during these dates only.
ASPHostPortal.com is a hosting company that best support in Windows and ASP.NET-based hosting. Services include shared hosting, reseller hosting, and sharepoint hosting, with specialty in ASP.NET, SQL Server, and architecting highly scalable solutions. As a leading small to mid-sized business web hosting provider, ASPHostPortal.com strive to offer the most technologically advanced hosting solutions available to all customers across the world. Security, reliability, and performance are at the core of hosting operations to ensure each site and/or application hosted is highly secured and performs at optimum level.