Azure - Creating External Tables

0 comments
Don't let this happen to you!

1) First of all, If you have used the "Script Table as" menu item in SSM Studio to get the initial script for an external table, it will not include the schema_name or object_name to the data source, so add it. in other words....


CREATE EXTERNAL TABLE [dbo].[ExternalTableName]
(
	[Colum1] [int] NOT NULL,
	[Colum2] [nvarchar](150) NULL,
	[Colum3] [nvarchar](max) NULL
)
with (data_source=[SourceDB]) 


becomes


CREATE EXTERNAL TABLE [dbo].[ExternalTableName]
(
	[Colum1] [int] NOT NULL,
	[Colum2] [nvarchar](150) NULL,
	[Colum3] [nvarchar](max) NULL
)
with (data_source=[SourceDB], schema_name='dbo', object_name='SourceTableName') 


2) Next make sure there are no nText DataTypes involved in either of the tables. Convert these to nvarchar(max).


Note: It is probably prudent to create a test table of any table you are about to update, run a select statement on it to ensure that it's been created successfully. Then drop and create the real thing once you know your sql is correct and working.











Comments


Leave a Comment