alter column in sql server

Author: Rafael Copquin

Posted: 2018-09-06 at 09:27:53

I need to import a DBF table into SQL Server

However, all the fields in the DBF table begin with the suffix ST (a

previous programmer built the table in 1992, with the notion that all

fields should have a specific suffix related to the table's purpose)

But I just want the sql server table to have all its fields without that

suffix, ie: STACCT should become ACCT, STNAME should become NAME and so on,

The DBF table has 60 fields.

I would like to issue an ALTER TABLE statement directly in the SQL Server

Management Studio to remove the ST suffix from all its fields.

But I have no idea on how to build a stored procedure with something

similar to a DO WHILE loop in SQL Server, such that it would read a field

name, remove the ST suffix and alter the name as desired. And then pass to

the next field and do the same

In fact, I must do the same with all the DBF tables from the old DOS

system, because I am converting it to a VFP9 app with a SQL Server back end.

Please show me a code snippet that would do that

Thank you in advance

Rafael Copquin

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/CAHM-jJ2=YiH4U9okG8kR=CCYYmgkeeRXhftmc6eZzREJ+VmOUw@mail.gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2018 Rafael Copquin