My query is like this
WITH p AS ( select idA from TableA )
insert into TableB(idB,idA,city,data)
select sp_get_id('TableB'),p.idA from p,'TO',now()
Note: sp_get_id('TableB') is a stored procedure to generated id. I execute the query above and it is wrong.
,'TO',now()supposed to do? Perhaps if you could better explain what, overall, you are trying to do here and the relevant code like... what your proc is doing, (in and out params), or why a CTE?