Nov 14, 2003 #1 WurzelGummidge Technical User Joined Mar 18, 2003 Messages 27 Location GB Is there a statetment that finds a field name (ie SECCODEID) in all the tables across a SQL DB ?
Nov 14, 2003 1 #2 sunila7 Technical User Joined Apr 11, 2001 Messages 1,087 Location US Try this: SELECT * from Information_Schema.Columns where COLUMN_NAME= 'SECCODEID' Sunil Upvote 0 Downvote
Nov 14, 2003 Thread starter #3 WurzelGummidge Technical User Joined Mar 18, 2003 Messages 27 Location GB That is perfect - i may be pushing my luck here but, further to your answer, how would i construct a sql statement that did the following: Where ANY table has the field SECCODEID = 'abc123' update SECCODEID to equal 'xyz321' Upvote 0 Downvote
That is perfect - i may be pushing my luck here but, further to your answer, how would i construct a sql statement that did the following: Where ANY table has the field SECCODEID = 'abc123' update SECCODEID to equal 'xyz321'
Nov 14, 2003 #4 sunila7 Technical User Joined Apr 11, 2001 Messages 1,087 Location US Try this: SELECT 'UPDATE [' + Table_name + '] SET SECCODEID = ''xyz13'' where city=''abc13''' from Information_Schema.Columns where COLUMN_NAME= 'SECCODEID' This select statement should give u the SQL to update in the o/p window in QA. Copy all the SQL's and run it in QA. Hope this helps Sunil Upvote 0 Downvote
Try this: SELECT 'UPDATE [' + Table_name + '] SET SECCODEID = ''xyz13'' where city=''abc13''' from Information_Schema.Columns where COLUMN_NAME= 'SECCODEID' This select statement should give u the SQL to update in the o/p window in QA. Copy all the SQL's and run it in QA. Hope this helps Sunil
Nov 14, 2003 Thread starter #5 WurzelGummidge Technical User Joined Mar 18, 2003 Messages 27 Location GB Thanks once again, simple, straightforward, works-first-time answers that we all hope for but much too often get over-complicated. EXCELLENT Upvote 0 Downvote
Thanks once again, simple, straightforward, works-first-time answers that we all hope for but much too often get over-complicated. EXCELLENT