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.
Author |
Topic |
abuzar
Starting Member
20 Posts |
Posted - 2014-09-25 : 09:06:29
|
I have a table name tbl_testme with columns (id,mac,keys,outputmk)mac column have 12 character and keys have 16 charactermac keys6545da7n9hg8 hsi457s5sd77jk87what i want is i need to split the column into 4 characters of both columnE.G(6545 da7n 9hg8) and (hsi4 57s5 sd77 jk87)after splitting i need to take last 4 character of key(jk87) and last 4 character of mac(9hg8)and join them and insert that into ouputmk column.E.G.(jk87-9hg8-sd77-da7n-57s5-6545-hsi4) i need this to insert in outputmk columnany help and explanation will be appreciated alot..:)) |
|
Arun Babu N
Starting Member
26 Posts |
Posted - 2014-09-25 : 09:27:06
|
Select right('6545da7n9hg8',4)+ right('hsi457s5sd77jk87',4) arunbabu |
|
|
abuzar
Starting Member
20 Posts |
Posted - 2014-09-25 : 09:57:13
|
thanks for the reply dude but not the solution i needed..hopefully i managed to get my output as i mentioned below i s the query.select reverse( SUBSTRING(keys,13,4)+'-'+ (select SUBSTRING(mac,9,4))+'-'+SUBSTRING(keys,9,4)+'-'+(select SUBSTRING(mac,5,4))+'-'+SUBSTRING(keys,5,4)+'-'+(select SUBSTRING(mac,1,4))+'-'+SUBSTRING(keys,1,4)) as test from tbl_testmecan any help me writing a trigger to update the output i got in "test" to my column name (outputpk)in my same table. |
|
|
|
|
|
|
|