MS-SQL > Alter Table µî·ÏÀÏ : 2017-06-30 18:46 Á¶È¸¼ö : 52,8861. ¿ Ãß°¡
alter table zipcode add TEST_COL varchar(30) null 2. ¿ »èÁ¦ alter table zipcode DROP COLUMN TEST_COL 3. Ä®·³ º¯°æ (test_col -> test1_col) Exec sp_rename 'zipcode.test_col','test1_col' 4. Ä®·³ ±æÀÌÁ¶Á¤ ¿¹Á¦ alter table Å×À̺í¸í alter column Ä®·³¸í varchar(100); (Ä®·³¸í varchar ÇüÀ» varchar(100) À¸·Î º¯°æ) 5. µ¥ÀÌÅÍ À߶óÁö´Â °æ¿ì ó¸® ¹æ¹ý alter table test_table alter column test_column varchar(2); ÀÌ·±½ÄÀ¸·Î Çߴµ¥... ¸¸¾à ±âÁ¸¿¡ test_column ÀÌ varchar(10) À̾ú°í ÀÌ¹Ì ÀúÀåµÈ °ªÀÌ 3 ÀÌ»óÀÏ °æ¿ì Àú À§ÀÇ ¸í·É¾î´Â String or binary data would be truncated. The statement has been terminated. µÇ°Ô µË´Ï´Ù. ÀÌ°É ¹«½ÃÇÏ°í ±×³É alter ½Ãų¼ö ÀÖ´ÂÁö¿ä. ¿¹¸¦µé¾î ±âÁ¸°ªÀÌ 'abcdefg' ¶ó°í µÇ¾îÀÖ°í varchar(2) ·Î alter ÇÒ¶§ ÀÚµ¿À¸·Î 'ab' ·Î ¹Ù²î°Ô ÇÑ´Ù´ø°¡... ------------------------------------------------------------- set ansi_warnings ¿É¼ÇÀ» off ½ÃÅ°½Ã°í ÇÏ½Ã¸é µË´Ï´Ù. -- Áغñ create table test_table (test_column varchar(10)) insert test_table values('1234567890') ----------------------------------- -- ¿©±âºÎÅÍ set ansi_warnings off alter table test_table alter column test_column varchar(2); ----------------------------------- -- Å×½ºÆ® select * from test_table ----------------------------------- -- °á°ú test_column ----------------------------------- 12 6. identity ¼³Á¤ ALTER TABLE LookupStates ADD Id int IDENTITY(1,1) PRIMARY KEY not null
|