DB2 Statements to SQL

Padmanabhan, Venkatesh 246 Reputation points
2020-12-17T09:48:55.89+00:00

Hi.

I am trying to migrate queries from DB2 to SQL. I have few statements in DB2 which I am not sure, how to have similar statement in SQL.

How to use commands / equivalent of - REFRESH TABLE , RUNSTATS in SQL ?

Thanks

SQL Server Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. tibor_karaszi@hotmail.com 4,316 Reputation points
    2020-12-17T10:39:01.273+00:00

    For RUNSTATS, you use UPDATE STATISTICS, documented here: https://learn.microsoft.com/en-us/sql/t-sql/statements/update-statistics-transact-sql?view=sql-server-ver15

    There is no equivalent to REFRESH TABLE, since SQL Server doesn't have the concept of materialized query tables in the same way as DB2 has. We have indexed views, but they are always kept up-to-date, so no refresh is necessary (or possible).

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.