SMALL
if (dataGridView2.Rows[0].Cells[2].Value.ToString().Trim() != dataGridView2.Rows[0].Cells[9].Value.ToString().Trim())
{
if(dataGridView2.Rows[0].Cells[2].Value.ToString().Trim() == "NO")
{
string alterTable = "ALTER TABLE " + tbl + " MODIFY `" + dataGridView2.Rows[0].Cells[7].Value.ToString() + "` " + dataGridView2.Rows[0].Cells[1].Value.ToString() not null;
Create(alterTable);
}
else if(dataGridView2.Rows[0].Cells[2].Value.ToString().Trim() == "YES")
{
string alterTable = "ALTER TABLE " + tbl + " MODIFY `" + dataGridView2.Rows[0].Cells[7].Value.ToString() + "` " + dataGridView2.Rows[0].Cells[1].Value.ToString();
Create(alterTable);
}
}
https://gocoder.tistory.com/2376
MySQL - 컬럼 not null 로 변경하기 / alter table
컬럼 속성을 not null -> null 안녕하세요. 고코더 입니다. 테이블을 사용할 때 기본 속성은 null을 허용합니다. 하지만 간혹 생성 후에 not null 일명 null 값이 들어가지 못하게 하도록 변경할 때가 있습
gocoder.tistory.com
LIST
'일반' 카테고리의 다른 글
alter utf8, 자동증가 (0) | 2022.03.30 |
---|---|
MYSQL 커멘트변경 CHANGE (0) | 2022.03.29 |
SQL 기본값이 다를경우 (0) | 2022.03.29 |
SQL 타입이 다를경우 (0) | 2022.03.29 |
SQL 필드 확인후 필드가 없을경우 (0) | 2022.03.29 |