In the table Tab06_SubTab02, you have field defined as an integer.
The corresponding field in the select statement is a smalldatetime.
Even though there are no rows returned, SQL still compiles the query and throws a compile time error.
You need to match up the fields in the insert to the fields in the select and compare the data types. An integer field cannot be populated by a smalldatetime field.
As an easier example, this will throw the same error:
DECLARE @tab TABLE
(
IntegerField int
)
DECLARE @smalldatetime smalldatetime
INSERT INTO @tab(IntegerField)
SELECT @smalldatetime
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/