New answers tagged temp-tables
The error is happening because the stored procedure also has a #temp table or table variable and inserts into it using insert...exec. You can see it by looking at its OBJECT_DEFINITION(): insert into @countab (pendingcmdcount) exec @retcode = sys.sp_MSget_repl_commands So basically you asking for this (pseudo-code): INSERT INTO #outer EXEC ...
Thanks for the answer. Just before I posted a question here I did a search Microsoft Connect bug list however nothing came up here and I used dm_sql_referenced_entities as keyword. I've posted the same bug and that's available at https://connect.microsoft.com/SQLServer/feedback/details/1859356. Let's say I understand Microsoft policy about that. I wonder ...
This is a bug in SQL Server and here is a Connect item to vote for if you want a change. dm_sql_referenced_entities does not shows columnes when temporary tables are used in statement Current status: We believe it is unlikely that we will address this suggestion, and so we are closing it as “won’t fix”.
First go to the menu and choose: database → create → table The follow prompt, choose schema, select object type (view, table etc). Also make sure your column structure does not interfere with importing since the same rules apply with importing data when it comes to column spaces etc.. (Column names with spaces etc...)
Community wiki answer generated from comments to the question by various people. Despite the name, you are declaring #results as a Common Table Expression (CTE), not a temporary table. CTEs only apply to the same statement they are defined in. You can solve your problem using a temporary table, using syntax like: CREATE TABLE #mytable (<columns>); ...
You can maintain this column easily: ;WITH x AS ( SELECT case_id, modify_time, version, rn = ROW_NUMBER() OVER (PARTITION BY case_id ORDER BY modify_date) FROM dbo.source_table ) UPDATE x SET version = rn WHERE version <> rn; But since you could also generate that version column on the fly every time you need to query (maybe it could be in ...
Top 50 recent answers are included