# Kiểm tra Table

## Kiểm tra table trên SQL, vào quản lý Form, gọi mở form00099

```sql
SELECT 
    s.name AS [Schema],
    t.name AS [Table Name],
    t.create_date AS [Created Date],
    t.modify_date AS [Last Modified]
FROM sys.tables t
INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
where t.name like '%__REP%' --Table bắt đầu chữ _Rep
ORDER BY t.create_date DESC, [Table Name];
```

## XÓA ĐI TABLE TEMP

```sql
declare @sql nvarchar(max),@tbl nvarchar(500)
declare cs cursor for
select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME like '__Rep_%'
open cs
fetch next from cs into @tbl
While @@FETCH_STATUS=0
begin
	set @sql='drop table '+@tbl
	exec sp_executesql @sql
	set @sql=''
fetch next from cs into @tbl
end 
close cs
deallocate cs
```

## XÓA ĐI VIEW TEMP

<pre class="language-sql"><code class="lang-sql"><strong>declare @sql nvarchar(max),@tbl nvarchar(500)
</strong>declare cs cursor for
select TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME like 'ZzzViewTempRerpot%'
open cs
fetch next from cs into @tbl
While @@FETCH_STATUS=0
begin
	set @sql='drop view '+@tbl
	exec sp_executesql @sql
	set @sql=''
fetch next from cs into @tbl
end 
close cs
deallocate cs
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kythuat.dtechvn.com/effect/kiem-tra-table.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
