Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 adding a space or a character after 4 digits

Author  Topic 

ppatel112
Starting Member

35 Posts

Posted - 2015-03-05 : 19:39:02
Hi Peeps,

i have a column in sql table where it consists of a card number for e.g. 5555444433332222

i want to write a select statement with the column name with card number above for me to export to csv.

the format needs to be like 5555-4444-3333-2222

How can we achieve this?

thanks,
parth

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-05 : 19:54:02
You can use the SUBSTRING function for this.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -