Select into openquery control nullability

When we use select into and create a table, how to control  null-ability?

By default it is driven by source table from which we are selecting.

But what about if we want to change the null-ability from source to target. Say we have few columns, which are not-null (required) on source side, but we need them null allowed on target side, then:

use any expression that uses a built-in function like SUBSTRING, LEFT, RIGHT etc (except ISNULL)

Example 1:

select col1, col2 into TargetTable from openquery (LinkedServerName, ‘select to_char(col1) as col1, to_char(col2) as col2 from SourceTable’)

Reference 1



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s