当前位置: 动力学知识库 > 问答 > 编程问答 >

sql server - Changing keys and data for Azure Mobile Service

问题描述:

I have an existing Azure web application backed by an Azure SQL db. My plan is to utilize this same db in new mobile applications I am building, however I made a design decision originally that doesn't work with Azure Mobile Services. I made my keys in the existing database integer ID's and as of recently to utilize a db within the Mobile service it needs ID's that are String GUID's. I have over 200 users entered in my existing database with other associated tables all tied to these ID's.

My question is, is there a feature or methodology for converting all of these integer keys to string keys without dropping all of their data and requiring everyone to manually go in and re set things up again?

My database knowledge is limited but from all I've seen, Azure Mobile Service requires that the keys be strings now and there isn't a work around for it.

Any help is much appreciated, Thanks!

网友答案:

To change the datatype of a column in SQL, just simply run the following command:

ALTER TABLE table_name
ALTER COLUMN column_name column_type

For example, assume your table name is table1 and the column is called keys,

ALTER TABLE table1
ALTER COLUMN keys varchar(10)
分享给朋友:
您可能感兴趣的文章:
随机阅读: