<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL Server Table - MSSQL Query</title>
	<atom:link href="https://mssqlquery.com/tag/sql-server-table/feed" rel="self" type="application/rss+xml" />
	<link>https://mssqlquery.com</link>
	<description>MSSQL and TSQL Programming and TSQL Examples</description>
	<lastBuildDate>Thu, 24 Nov 2022 20:18:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.1</generator>

<image>
	<url>https://mssqlquery.com/wp-content/uploads/2023/06/cropped-mssql-query-icon-32x32.png</url>
	<title>SQL Server Table - MSSQL Query</title>
	<link>https://mssqlquery.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>To See Which Tables Have Been Processed Last in SQL Server</title>
		<link>https://mssqlquery.com/to-see-which-tables-have-been-processed-last-in-sql-server</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Thu, 24 Nov 2022 20:18:41 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[How Do I Find Who Last Edited a Record or Table in a Database?]]></category>
		<category><![CDATA[SQL Server Find Table]]></category>
		<category><![CDATA[SQL Server Table]]></category>
		<guid isPermaLink="false">https://mssqlquery.com/?p=1216</guid>

					<description><![CDATA[<p>Hello everyone, In this article, I will try to give information about seeing which tables were processed last in SQL Server. In SQL Server, in some cases, you may want to see which tables were processed last. You can easily do this using the code below. SELECT DB_NAME(ius.[database_id]) AS [Database],&#46;&#46;&#46;</p>
<p>The post <a href="https://mssqlquery.com/to-see-which-tables-have-been-processed-last-in-sql-server">To See Which Tables Have Been Processed Last in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>In this article, I will try to give information about seeing which tables were processed last in SQL Server.</p>
<p>In SQL Server, in some cases, you may want to see which tables were processed last.</p>
<p>You can easily do this using the code below.</p>
<pre class="line-numbers"><code class="language-sql">SELECT DB_NAME(ius.[database_id]) AS [Database],
       OBJECT_NAME(ius.[object_id]) AS [TableName],
       MAX(ius.[last_user_lookup]) AS [last_user_lookup],
       MAX(ius.[last_user_scan]) AS [last_user_scan],
       MAX(ius.[last_user_seek]) AS [last_user_seek]
FROM sys.dm_db_index_usage_stats AS ius
WHERE ius.[database_id] = DB_ID()
GROUP BY ius.[database_id],
         ius.[object_id];</code></pre>
<p>When you run the above code, you will see a result similar to the one below.</p>
<p><img decoding="async" fetchpriority="high" class="alignnone wp-image-1218 size-full" src="https://mssqlquery.com/wp-content/uploads/2022/11/to-see-which-tables-have-been-processed-last-in-sql-server-1.png" alt="To See Which Tables Have Been Processed Last in SQL Server" width="700" height="363" srcset="https://mssqlquery.com/wp-content/uploads/2022/11/to-see-which-tables-have-been-processed-last-in-sql-server-1.png 700w, https://mssqlquery.com/wp-content/uploads/2022/11/to-see-which-tables-have-been-processed-last-in-sql-server-1-300x156.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>As you can see, we have seen which tables were processed last.</p>
<p>Good luck to everyone in business and life.</p>
<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 65</span><span class='epvc-label'> Views</span></div><p>The post <a href="https://mssqlquery.com/to-see-which-tables-have-been-processed-last-in-sql-server">To See Which Tables Have Been Processed Last in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Comma-Separating Table Columns into Lists in SQL Server</title>
		<link>https://mssqlquery.com/comma-separating-table-columns-into-lists-in-sql-server</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Wed, 23 Nov 2022 21:05:30 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Comma-Separating Table Columns into Lists in SQL Server]]></category>
		<category><![CDATA[SQL Server Table]]></category>
		<category><![CDATA[SQL Server Table Name List]]></category>
		<guid isPermaLink="false">https://mssqlquery.com/?p=1208</guid>

					<description><![CDATA[<p>Hello everyone, In this article, I will try to give information about separating table columns with commas and making them a list in SQL Server. In SQL Server, in some cases, the number of columns in your table may be high. Instead of typing the column names one by one&#46;&#46;&#46;</p>
<p>The post <a href="https://mssqlquery.com/comma-separating-table-columns-into-lists-in-sql-server">Comma-Separating Table Columns into Lists in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>In this article, I will try to give information about separating table columns with commas and making them a list in SQL Server.</p>
<p>In SQL Server, in some cases, the number of columns in your table may be high. Instead of typing the column names one by one after SELECT, you can list all the column names by using the code below. Or you can dynamically use this query in various places.</p>
<p>You can easily do this using the code below.</p>
<pre class="line-numbers"><code class="language-sql">DECLARE @TABLE_NAME VARCHAR(128);
DECLARE @SCHEMA_NAME VARCHAR(128);

SET @TABLE_NAME = 'Categories';
SET @SCHEMA_NAME = 'dbo';

DECLARE @vvc_ColumnName VARCHAR(128);
DECLARE @vvc_ColumnList VARCHAR(MAX);

IF @SCHEMA_NAME = ''
BEGIN
    PRINT 'Error : Schema not defined!';
    RETURN;
END;

IF NOT EXISTS
(
    SELECT *
    FROM sys.tables T
        JOIN sys.schemas S
            ON T.schema_id = S.schema_id
    WHERE T.name = @TABLE_NAME
          AND S.name = @SCHEMA_NAME
)
BEGIN
    PRINT 'Error : Table Name : ''' + @TABLE_NAME + ''' and Schema Name : ''' + @SCHEMA_NAME + ''' not found in database';
    RETURN;
END;

DECLARE TableCursor CURSOR FAST_FORWARD FOR
SELECT CASE
           WHEN PATINDEX('% %', C.name) &gt; 0 THEN
               '[' + C.name + ']'
           ELSE
               C.name
       END
FROM sys.columns C
    JOIN sys.tables T
        ON C.object_id = T.object_id
    JOIN sys.schemas S
        ON S.schema_id = T.schema_id
WHERE T.name = @TABLE_NAME
      AND S.name = @SCHEMA_NAME
ORDER BY column_id;


SET @vvc_ColumnList = '';

OPEN TableCursor;
FETCH NEXT FROM TableCursor
INTO @vvc_ColumnName;

WHILE @@FETCH_STATUS = 0
BEGIN
    SET @vvc_ColumnList = @vvc_ColumnList + @vvc_ColumnName;

    -- get the details of the next column
    FETCH NEXT FROM TableCursor
    INTO @vvc_ColumnName;

    -- add a comma if we are not at the end of the row
    IF @@FETCH_STATUS = 0
        SET @vvc_ColumnList = @vvc_ColumnList + ',';
END;

CLOSE TableCursor;
DEALLOCATE TableCursor;

PRINT 'Comma Separated Column Names';
PRINT '--------------------------------------------------';
PRINT @vvc_ColumnList;</code></pre>
<p>When you run the above code, you will see a result similar to the one below.</p>
<p><img decoding="async" class="alignnone wp-image-1210 size-full" src="https://mssqlquery.com/wp-content/uploads/2022/11/comma-separating-table-columns-into-lists-in-sql-server-1.jpg" alt="Comma-Separating Table Columns into Lists in SQL Server" width="700" height="395" srcset="https://mssqlquery.com/wp-content/uploads/2022/11/comma-separating-table-columns-into-lists-in-sql-server-1.jpg 700w, https://mssqlquery.com/wp-content/uploads/2022/11/comma-separating-table-columns-into-lists-in-sql-server-1-300x169.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>As you can see, we have separated the table columns with commas and turned them into a list.</p>
<p>Good luck to everyone in business and life.</p>
<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 136</span><span class='epvc-label'> Views</span></div><p>The post <a href="https://mssqlquery.com/comma-separating-table-columns-into-lists-in-sql-server">Comma-Separating Table Columns into Lists in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
