在sql语句中必须给每列加上isnull, 而且在isnull中要加上cast,否则出来的类型还是DBNull
如下
SELECT [StagingViewName],[HasTarget],isnull([TargetViewName],' ') [TargetViewName],isnull(cast([SqlQuery] as varchar(4000)),' ') [SqlQuery],isnull(cast([TargetSqlQuery] as varchar(4000)),' ') [TargetSqlQuery] FROM [selfboard].[StagingViews] where [SourceName] like ?