Author |
Topic |
mohan123
Constraint Violating Yak Guru
252 Posts |
Posted - 2013-02-05 : 23:47:50
|
hello all,i am havind the codes like this 48267799851075522205762758772is there any function or query to make this codes '48267''7998''51075''52220''57627''58772'in mssql OR eXCEL ....Suggest meP.V.P.MOhan |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2013-02-06 : 00:07:43
|
is that string or numbers ?if it is string just simpleselect '''' + string_column + '''' from yourtable if it is numbers, you will have to convert to string fristselect '''' + convert(varchar(10), numbers_column) + '''' from yourtable KH[spoiler]Time is always against us[/spoiler] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-06 : 00:13:16
|
nope. you've to write oneSELECT '''' + CAST(Column AS varchar(100)) + '''' FROM tablein case column is already of character type, you can dispense with the CAST part------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-06 : 00:15:28
|
ah...didnt refresh------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
mohan123
Constraint Violating Yak Guru
252 Posts |
Posted - 2013-02-06 : 00:34:17
|
khtan and visakh it worked like charm.But i did this one in excel by following this steps :1) copied all rows in Excel column and beside columns i gave " quotes on both sides.then copied in mssql and written LTRIM and RTRIM but your query is so accurate.I will use this oneP.V.P.MOhan |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-06 : 00:37:55
|
you can use both ways. i also use Excel for generating queries on the fly------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
mohan123
Constraint Violating Yak Guru
252 Posts |
Posted - 2013-02-06 : 00:40:45
|
Excel can be used to generate MSSQL queries????HOWP.V.P.MOhan |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-06 : 00:55:40
|
copying data over sheet and then applying excel formulas to generate values on the fly------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2013-02-08 : 07:47:51
|
Do it in EXCEL that will be very easyMadhivananFailing to plan is Planning to fail |
|
|
|