Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integer to string conversion function in sql

Tags:

sql

sql-server

I have a number as follows: 13901210 I want the output to give the following result 1390/12/10

Input function: a number of bigint Output: a string

How do I create this function?

like image 582
user1346774 Avatar asked Jun 20 '26 03:06

user1346774


1 Answers

I wonder why no one suggested this Simple Query

declare @input bigint=13901210

select REPLACE(Convert(varchar,Convert(date,CONVERT(varchar,@input))),'-','/')

SQL Fiddle

like image 69
Prahalad Gaggar Avatar answered Jun 23 '26 04:06

Prahalad Gaggar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!