Nov 18, 2008 #1 Brianfree Programmer Joined Feb 6, 2008 Messages 220 Location GB Hi is it possible to add text to a position in a string ie.. I have the following value in a field "199407" and i want to change it to "1994.07" Kindest thanks, Brian
Hi is it possible to add text to a position in a string ie.. I have the following value in a field "199407" and i want to change it to "1994.07" Kindest thanks, Brian
Nov 18, 2008 1 #2 JohnDTampaBay Programmer Joined Jul 12, 2002 Messages 986 Location US Code: UPDATE table SET column = Left(column, Len(column) - 2) + '.' + Right(column, 2) Something like this should work. --John ----------------------------------- Behold! As a wild ass in the desert go forth I to do my work. --Gurnie Hallock (Dune) Upvote 0 Downvote
Code: UPDATE table SET column = Left(column, Len(column) - 2) + '.' + Right(column, 2) Something like this should work. --John ----------------------------------- Behold! As a wild ass in the desert go forth I to do my work. --Gurnie Hallock (Dune)
Nov 18, 2008 Thread starter #3 Brianfree Programmer Joined Feb 6, 2008 Messages 220 Location GB Thanks for a fast reply can this be done "on the fly" or will i have to use an update statment? Many thanks! Brian Upvote 0 Downvote
Thanks for a fast reply can this be done "on the fly" or will i have to use an update statment? Many thanks! Brian
Nov 18, 2008 Thread starter #4 Brianfree Programmer Joined Feb 6, 2008 Messages 220 Location GB Sorry! just figured it out from your example! Many thanks, Brian Upvote 0 Downvote
Nov 18, 2008 Thread starter #5 Brianfree Programmer Joined Feb 6, 2008 Messages 220 Location GB Thought i had a winner, however if the field is null i get an error message... Left(Vehicles.Start_Date,Len(Vehicles.Start_Date)-2)+'.'+Right(Vehicles.Start_Date,2) AS Expr1 can i modify this so it only does this to a field if it is not null? Many thanks! Brian Upvote 0 Downvote
Thought i had a winner, however if the field is null i get an error message... Left(Vehicles.Start_Date,Len(Vehicles.Start_Date)-2)+'.'+Right(Vehicles.Start_Date,2) AS Expr1 can i modify this so it only does this to a field if it is not null? Many thanks! Brian
Nov 18, 2008 1 #6 gmmastros Programmer Joined Feb 15, 2005 Messages 14,912 Location US In that case, try the Stuff function. Code: Stuff(Vehicles.Start_Date, 5, 0, '.') As Expr1 If vehicle.start_date is null, then Expr1 will be null. -George "The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom Upvote 0 Downvote
In that case, try the Stuff function. Code: Stuff(Vehicles.Start_Date, 5, 0, '.') As Expr1 If vehicle.start_date is null, then Expr1 will be null. -George "The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom