I love reader’s contribution this blog as that brings variety in articles. I encourage my readers to provide their contribution and I will publish then with their name.
Blog Reader Ashish Jain has posted very simple script which will remove duplicate entry from comma delimited string. User Defined Function has very simple logic behind it. It [...]
Archive for the ‘SQL String’ Category
SQL SERVER – Remove Duplicate Entry from Comma Delimited String – UDF
Posted in Pinal Dave, Readers Contribution, SQL, SQL Authority, SQL Function, SQL Query, SQL Scripts, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology on January 15, 2009 | 8 Comments »
SQL SERVER – Get Numeric Value From Alpha Numeric String – UDF for Get Numeric Numbers Only
Posted in Pinal Dave, SQL, SQL Authority, SQL Function, SQL Query, SQL Scripts, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology on October 14, 2008 | 5 Comments »
SQL is great with String operations. Many times, I use T-SQL to do my string operation. Let us see User Defined Function, which I wrote few days ago, which will return only Numeric values from AlphaNumeric values.
CREATE FUNCTION dbo.udf_GetNumeric
(@strAlphaNumeric VARCHAR(256))
RETURNS VARCHAR(256)
AS
BEGIN
DECLARE @intAlpha INT
SET @intAlpha = PATINDEX(‘%[^0-9]%’, @strAlphaNumeric)
BEGIN
WHILE @intAlpha > 0
BEGIN
SET @strAlphaNumeric = STUFF(@strAlphaNumeric, @intAlpha, 1, ” )
SET [...]
SQL SERVER – 2008 – Enhenced TRIM() Function – Remove Trailing Spaces, Leading Spaces, White Space, Tabs, Carriage Returns, Line Feeds
Posted in Pinal Dave, SQL, SQL Authority, SQL Function, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL String, SQL Tips and Tricks, SQL Utility, T SQL, Technology on October 10, 2008 | 8 Comments »
After reading my article SQL SERVER – 2008 – TRIM() Function – User Defined Function, I have received email and comments where user are asking if it is possible to remove trailing spaces, leading spaces, white space, tabs, carriage returns, line feeds etc.
I found following script posted by Russ and Erik. It is modified a [...]
SQL SERVER – Remove Duplicate Characters From a String
Posted in SQL, SQL Authority, SQL Function, SQL Query, SQL Scripts, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology on December 30, 2007 | 9 Comments »
Follow up of my previous article of Remove Duplicate Chars From String here is another great article written by Madhivanan where similar solution is suggested with alternate method of Number table approach. Check out Remove duplicate characters from a string
Reference : Pinal Dave (http://blog.SQLAuthority.com)
SQL SERVER – Do Not Store Images in Database – Store Location of Images (URL)
Posted in Database, Pinal Dave, SQL, SQL Authority, SQL Interview Questions and Answers, SQL Query, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology on December 13, 2007 | 15 Comments »
Just a day ago I received phone call from my friend in Bangalore. He asked me
What do I think of storing images in database and what kind of datatype he should use?
I have very strong opinion about this issue.
I suggest to store the location of the images in the database using VARCHAR datatype instead of [...]
SQL SERVER – UDF – Remove Duplicate Chars From String
Posted in Pinal Dave, SQL, SQL Authority, SQL Function, SQL Query, SQL Scripts, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology, tagged Duplicate Records on December 5, 2007 | 4 Comments »
Few days ago, I received following wonderful UDF from one of this blog reader. This UDF is written for specific purpose of removing duplicate chars string from one large string. Virendra Chauhan, author of this UDF is working as DBA in Lutheran Health Network.
CREATE FUNCTION dbo.REMOVE_DUPLICATE_INSTR
(@datalen_tocheck INT,@string VARCHAR(255))
RETURNS VARCHAR(255)
AS
BEGIN
DECLARE @str VARCHAR(255)
DECLARE @count INT
DECLARE @start INT
DECLARE [...]
SQL SERVER – 2005 Collation Explanation and Translation – Part 2
Posted in Pinal Dave, SQL, SQL Authority, SQL Documentation, SQL Query, SQL Scripts, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology, tagged SQL Collation on July 14, 2007 | 1 Comment »
Following function return all the available collation of SQL Server 2005. My previous article about the SQL SERVER – 2005 Collation Explanation and Translation.
SELECT *
FROM sys.fn_HelpCollations()
Result Set: (only few of 1011 records)
Name [...]
SQL SERVER – Fix : Error : Server: Msg 131, Level 15, State 3, Line 1 The size () given to the type ‘varchar’ exceeds the maximum allowed for any data type (8000)
Posted in Pinal Dave, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology on June 30, 2007 | Leave a Comment »
Error:
Server: Msg 131, Level 15, State 3, Line 1 The size () given to the type ‘varchar’ exceeds the maximum allowed for any data type (8000)
When the the length is specified in declaring a VARCHAR variable or column, the maximum length allowed is still 8000.
Fix/WorkAround/Solution: Use either VARCHAR(8000) or VARCHAR(MAX) . VARCHAR(MAX) of SQL [...]
SQL SERVER – Repeate String N Times Using String Function REPLICATE
Posted in Pinal Dave, SQL, SQL Authority, SQL Function, SQL Query, SQL Scripts, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology on June 25, 2007 | 2 Comments »
I came across this SQL String Function few days ago while searching for Database Replication. This is T-SQL Function and it repeats the string/character expression N number of times specified in the function.
SELECT REPLICATE( ‘ http://www.SQLAuthority.com ‘ , 9 )
This repeats the string http://www.SQLAuthority.com to 9 times in result window. I think it is fun [...]
SQL SERVER – 2005 Row Overflow Data Explanation
Posted in Pinal Dave, SQL, SQL Authority, SQL Documentation, SQL Performance, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL String, SQL Tips and Tricks, T SQL, Technology on June 23, 2007 | 5 Comments »
In SQL Server 2000 and SQL Server 2005 a table can have a maximum of 8060 bytes per row. One of my fellow DBA said believed that SQL Server 2000 had that restriction but SQL Server 2005 does not have that restriction and it can have row of 2GB. I totally agreed with me but [...]
About Pinal Dave
Pinalkumar Dave is a Microsoft SQL Server MVP and a Mentor for Solid Quality India. He has written over 1100 articles on the subject on his blog at http://blog.sqlauthority.com. He is a dynamic and proficient Principal Database Architect, Corporate Trainer and Project Manager, who specializes in SQL Server Programming and has 7 years of hands-on experience. He holds a Masters of Science degree and a number of certifications, including MCDBA and MCAD (.NET). He was awarded Regional Mentor for PASS Asia.
-
Blog Stats
- 10,987,074 Readers
SQLAuthority Links

My Homepage
My Resume
My Other Blog
--------------------
Top Downloads
PDF Downloads
Script Downloads
Script Bank
Favorite Scripts
All Scripts - 1
All Scripts - 2
Top Articles
Best Articles
Favorite Articles - 1
Favorite Articles - 2
--------------------
SQL Interview Q & A
SQL Coding Standards
SQL FAQ Download
--------------------
Jobs @ SQLAuthority
Top 7 Commenters
365 - Imran Mohammed
138- Brian Tkatch
57 - Tejas Shah
56 - Jacob Sebastian
47 - Jerry Hung
46 - Kuldip Bhatt
43 - Ashish GilhotraCategories
- About Me (61)
- Best Practices (91)
- Business Intelligence (14)
- Data Warehousing (30)
- Database (269)
- DBA (125)
- MVP (98)
- Poll (5)
- Readers Contribution (37)
- Readers Question (45)
- Software Development (67)
- SQL Add-On (91)
- SQL Backup and Restore (54)
- SQL BOL (10)
- SQL Coding Standards (20)
- SQL Constraint and Keys (51)
- SQL Cursor (28)
- SQL Data Storage (45)
- SQL DateTime (37)
- SQL Documentation (219)
- SQL Download (222)
- SQL Error Messages (125)
- SQL Function (124)
- SQL Humor (25)
- SQL Index (98)
- SQL Interview Questions and Answers (58)
- SQL Joins (64)
- SQL Optimization (66)
- SQL Performance (223)
- SQL Puzzle (26)
- SQL Security (119)
- SQL Server DBCC (42)
- SQL Server Management Studio (28)
- SQL Stored Procedure (102)
- SQL String (19)
- SQL System Table (50)
- SQL Trigger (24)
- SQL User Group (48)
- SQL Utility (126)
- SQL White Papers (37)
- SQLAuthority (375)
- SQL Training (1)
- SQLAuthority Author Visit (80)
- SQLAuthority Book Review (19)
- SQLAuthority News (345)
- SQLAuthority Website Review (29)
- SQLServer (77)
- Tech (915)
- Pinal Dave (905)
- SQL Scripts (533)
- Technology (1158)
- SQL (1158)
- SQL Authority (1158)
- SQL Query (1158)
- SQL Server (1158)
- SQL Tips and Tricks (1158)
- T SQL (1158)
-
Top Posts
- SQL SERVER - Insert Data From One Table to Another Table - INSERT INTO SELECT - SELECT INTO TABLE
- SQL SERVER - Insert Multiple Records Using One Insert Statement - Use of UNION ALL
- SQL SERVER - Retrieve Current Date Time in SQL Server CURRENT_TIMESTAMP, GETDATE(), {fn NOW()}
- SQL SERVER - Import CSV File Into SQL Server Using Bulk Insert - Load Comma Delimited File Into SQL Server
- SQL Server Interview Questions and Answers Complete List Download
- SQL SERVER - Convert Text to Numbers (Integer) - CAST and CONVERT
- SQL SERVER - 2005 - Create Script to Copy Database Schema and All The Objects - Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects
- SQL SERVER - Shrinking Truncate Log File - Log Full
- SQL SERVER - 2005 List All Tables of Database
- SQL SERVER - 2008 - Interview Questions and Answers Complete List Download
- SQL SERVER - Restore Database Backup using SQL Script (T-SQL)
- SQL Server Interview Questions and Answers - Part 1
-
Authors
-
pinaldave
- SQLAuthority News – Book Review – Expert SQL Server 2008 Encryption by Michael Coles
- SQL SERVER – Understanding Table Hints with Examples
- SQL SERVER – Size of Index Table – A Puzzle to Find Index Size for Each Index on Table
- SQL SERVER – 2005 2008 – Backup, Integrity Check and Index Optimization By Ola Hallengren
- SQLAuthority News – Notes of Excellent Experience at SQL PASS 2009 Summit, Seattle
- SQL SERVER – Whitepaper Consolidation Using SQL Server 2008
- SQLAuthority News – Disk Partition Alignment Best Practices for SQL Server
- SQL SERVER – Policy Based Management – Create, Evaluate and Fix Policies
- SQL SERVER – Disable CHECK Constraint – Enable CHECK Constraint
- SQL SERVER – Sharepoint Resource Available for SQL Server
-
Archives
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
Pages
Category Cloud
About Me Best Practices Database DBA MVP Pinal Dave Software Development SQL SQL Add-On SQL Authority SQLAuthority Author Visit SQLAuthority News SQL Documentation SQL Download SQL Error Messages SQL Function SQL Index SQL Joins SQL Optimization SQL Performance SQL Query SQL Scripts SQL Security SQLServer SQL Server SQL Stored Procedure SQL Tips and Tricks SQL Utility Technology T SQL


