Last post Sep 11, 2017 02:08 PM by PatriceSc
Sep 11, 2017 01:47 PM|krisrajz|LINK
Is there a way to force SQL to return latest stats? For both dynamic and static queries, sometimes it is not not updating stats.
Also would like to know to get execution plan for a complete dynamic SQL as it can't be parameterized.
Sep 11, 2017 02:08 PM|PatriceSc|LINK
https://docs.microsoft.com/en-us/sql/t-sql/statements/update-statistics-transact-sql ? You could also try to force just those that are really outdated to avoid a potential heavy load depending on your db size and design.
If you want to get the XML plan for queries try perhaps https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-exec-query-plan-transact-sql