修改client表字段属性为nvarchar.sql 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --client±í;
  2. use db
  3. IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[client]') AND name = N'id')
  4. DROP INDEX [id] ON [dbo].[client] WITH ( ONLINE = OFF )
  5. if not exists(select name from syscolumns where id=object_id('client') and name='photo')
  6. alter table [client] add [photo] [image] NULL
  7. alter table [client] alter column [id] [nvarchar] (50) NULL
  8. ------------------------------------------------------------
  9. alter table [client] alter column [name1] [nvarchar] (50) NULL
  10. alter table [client] alter column [name2] [nvarchar] (50) NULL
  11. alter table [client] alter column [phone1] [nvarchar] (50) NULL
  12. alter table [client] alter column [phone2] [nvarchar] (50) NULL
  13. alter table [client] alter column [qq1] [nvarchar] (50) NULL
  14. alter table [client] alter column [qq2] [nvarchar] (50) NULL
  15. alter table [client] alter column [addr1] [nvarchar] (50) NULL
  16. alter table [client] alter column [addr2] [nvarchar] (50) NULL
  17. alter table [client] alter column [occupation1] [nvarchar] (50) NULL
  18. alter table [client] alter column [occupation2] [nvarchar] (50) NULL
  19. alter table [client] alter column [birthday1] [nvarchar] (50) NULL
  20. alter table [client] alter column [birthday2] [nvarchar] (50) NULL
  21. alter table [client] alter column [time3] [nvarchar] (50) NULL
  22. alter table [client] alter column [area] [nvarchar] (50) NULL
  23. alter table [client] alter column [area2] [nvarchar] (50) NULL
  24. alter table [client] alter column [check1] [nvarchar] (50) NULL
  25. alter table [client] alter column [check2] [nvarchar] (50) NULL
  26. alter table [client] alter column [check3] [nvarchar] (50) NULL
  27. alter table [client] alter column [sex] [nvarchar] (50) NULL
  28. alter table [client] alter column [zodiac] [nvarchar] (50) NULL
  29. CREATE UNIQUE NONCLUSTERED INDEX [id] ON [dbo].[client]
  30. (
  31. [id] ASC
  32. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  33. use [2014]
  34. IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[client]') AND name = N'id')
  35. DROP INDEX [id] ON [dbo].[client] WITH ( ONLINE = OFF )
  36. if not exists(select name from syscolumns where id=object_id('client') and name='photo')
  37. alter table [client] add [photo] [image] NULL
  38. alter table [client] alter column [id] [nvarchar] (50) NULL
  39. ------------------------------------------------------------
  40. alter table [client] alter column [name1] [nvarchar] (50) NULL
  41. alter table [client] alter column [name2] [nvarchar] (50) NULL
  42. alter table [client] alter column [phone1] [nvarchar] (50) NULL
  43. alter table [client] alter column [phone2] [nvarchar] (50) NULL
  44. alter table [client] alter column [qq1] [nvarchar] (50) NULL
  45. alter table [client] alter column [qq2] [nvarchar] (50) NULL
  46. alter table [client] alter column [addr1] [nvarchar] (50) NULL
  47. alter table [client] alter column [addr2] [nvarchar] (50) NULL
  48. alter table [client] alter column [occupation1] [nvarchar] (50) NULL
  49. alter table [client] alter column [occupation2] [nvarchar] (50) NULL
  50. alter table [client] alter column [birthday1] [nvarchar] (50) NULL
  51. alter table [client] alter column [birthday2] [nvarchar] (50) NULL
  52. alter table [client] alter column [time3] [nvarchar] (50) NULL
  53. alter table [client] alter column [area] [nvarchar] (50) NULL
  54. alter table [client] alter column [area2] [nvarchar] (50) NULL
  55. alter table [client] alter column [check1] [nvarchar] (50) NULL
  56. alter table [client] alter column [check2] [nvarchar] (50) NULL
  57. alter table [client] alter column [check3] [nvarchar] (50) NULL
  58. alter table [client] alter column [sex] [nvarchar] (50) NULL
  59. alter table [client] alter column [zodiac] [nvarchar] (50) NULL
  60. CREATE UNIQUE NONCLUSTERED INDEX [id] ON [dbo].[client]
  61. (
  62. [id] ASC
  63. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]