Sorry Cetin, bad writing.
I send this on SQL Query Analyzer ( and on VFP SPT ).
USE pubs
exec sp_executesql N'USE master; SELECT @P1 ; SELECT DB_NAME()'
, N'@P1 INT', 1
SELECT DB_NAME()
result:
1
master
pubs
It is correct, the USE database within sp_executesql is valid only
within sp_executesql.
From the first moment, it would seem that the same commando, constructed from VFP in order to replace the ?parameter,
renders effective commando USE ( executed within sp_executesql ) in the connection , but I do not find one explanation.
Fabio