I had a strange scenario today and I can't reproduce it. I changed current database to adventureworks and ran following code DECLARE @SQL NVARCHAR(200) SET @SQL = 'SELECT DB_NAME()' EXEC sp_executesql @SQL EXEC (@SQL) The sp_executesql statement returned "master" and exec statement returned "adventureworks". Anyone knows why?
Print | posted on Thursday, December 04, 2008 4:58 PM | Filed Under [ SQL Server 2008 Administration SQL Server 2005 SQL Server 2000 ]
Powered by:
Copyright © Peter Larsson