SQL Server : 잘못된 열 이름
기존 SQL Server 저장 프로 시저를 수정하는 중입니다. 두 개의 새 열을 테이블에 추가하고 저장 프로시 저도 수정하여이 두 열도 선택했습니다. SQL Server Keeps 테이블에서 열을 사용할 수 있지만 다음 오류가 발생합니다.
잘못된 열 이름 'INCL_GSTAMOUNT'

누구든지 여기서 무엇이 잘못되었는지 말해 줄 수 있습니까?
이런 일이 발생하면 Ctrl+ Shift+ R를 눌러 새로 고침 intellisense하고 쿼리 창을 닫은 다음 (필요한 경우 저장) 일반적으로 잘 작동하는 새 세션을 시작합니다.
단일 대신 큰 따옴표로 문자열을 넣는 경우에도 발생할 수 있습니다.
이 오류는 캡슐화 된 SQL 문에서도 발생할 수 있습니다.
@tableName nvarchar (20) SET @tableName = 'GROC'선언
@updtStmt nvarchar (4000) 선언
SET @updtStmt = 'Update tbProductMaster_' +@tableName +' SET department_str = ' + @tableName exec sp_executesql @updtStmt
Only to discover that there are missing quotations to encapsulate the parameter "@tableName" further like the following:
SET @updtStmt = 'Update tbProductMaster_' +@tableName +' SET department_str = ''' + @tableName + ''' '
Thanks
Intellisense is not auto refreshed and you should not fully rely on that
I was getting the same error when creating a view.
Imagine a select query that executes without issue:
select id
from products
Attempting to create a view from the same query would produce an error:
create view app.foobar as
select id
from products
Msg 207, Level 16, State 1, Procedure foobar, Line 2
Invalid column name 'id'.
For me it turned out to be a scoping issue; note the view is being created in a different schema. Specifying the schema of the products table solved the issue. Ie.. using dbo.products instead of just products.
with refresh table or close and open sql server this work
I just tried. If you execute the statement to generate your local table, the tool will accept that this column name exists. Just mark the table generation statement in your editor window and click execute.
I had a similar problem.
Issue was there was a trigger on the table that would write changes to an audit log table. Columns were missing in audit log table.
Following procedure helped me solve this issue but i don't know why.
- Cut the code in question given by the lines in the message
- Save the query (e.g. to file)
- Paste the code to where it was before
- 다시 쿼리를 저장하십시오.
동일한 쿼리를 실행하는 것처럼 보이지만이 오류가 발생하지 않았습니다.
There can be many things:
First attempt, make a select of this field in its source table;
Check the instance of the sql script window, you may be in a different instance;
Check if your join is correct;
Verify query ambiguity, maybe you are making a wrong table reference
Of these checks, run the T-sql script again
[Image of the script SQL][1]
[1]: https://i.stack.imgur.com/r59ZY.png`enter code here
- 테이블을 새로 고칩니다.
- SQL 서버를 다시 시작하십시오.
- Query에서 맞춤법 오류를 찾으십시오.
참고 URL : https://stackoverflow.com/questions/18941514/sql-server-invalid-column-name
'Program Club' 카테고리의 다른 글
| Angular 2에서 Bootstrap navbar "활성"클래스를 설정하는 방법은 무엇입니까? (0) | 2020.11.25 |
|---|---|
| JavaScript 배열 또는 해시 테이블에 동적 키, 값 쌍 추가 (0) | 2020.11.25 |
| 같은 뷰에서 setFrame과 autolayout을 사용할 수 있습니까? (0) | 2020.11.25 |
| Visual Studio에서 모든 탭 닫기 (0) | 2020.11.25 |
| UILabel 내에서 텍스트를 세로로 정렬 (참고 : AutoLayout 사용) (0) | 2020.11.25 |