Ejemplo n.º 1
0
        public void GetTableFromQuery_ShouldReturnSqlResult_WhenNotSelectStatement()
        {
            const string sql = @"
DECLARE @sql nvarchar(max) = 'some dynamic sql'

EXEC sp_executesql (@sql)
";

            Assert.That(ImportFileHelper.GetTableNameFromSelectStatement(sql), Is.EqualTo("SQL RESULT"));
        }
Ejemplo n.º 2
0
        public void GetTableFromQuery_ShouldReturnTableName_WhenSelectStatement()
        {
            const string sql = @"
SELECT
    id
    ,mytext
    ,foo
    ,bar
from [Database].[schema].[table] t
WHERE
    id = 1;
";

            Assert.That(ImportFileHelper.GetTableNameFromSelectStatement(sql), Is.EqualTo("[DATABASE].[SCHEMA].[TABLE]"));
        }