일반

null값을 not null로 not null을 null로 바꾸기

알 수 없는 사용자 2022. 3. 29. 17:45
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