I am trying to insert data from one SQL table to another. The problem is that the columns have different data types. And when I use Cast() I still get the following error message:
[Msg 8114, Level 16, State 5, Line 3 Error converting data type varchar to bigint.]
Table1 columns have data types of bigint or int while Table2 columns are varchar. Any suggestions?
Here is my query:
INSERT INTO Table1
([RowId],
[Scenario],
[Entity],
[Project],
[TimePeriod])
SELECT Cast([ProjectMgrID] as bigint), Cast('ACT' as bigint),
Cast('APP' as bigint), Cast([Project] as bigint), Cast('201801' as int)
FROM Table2