DECLARE MyCursor CURSOR FOR select zdm,zdsx from #temp
set @sql = 'create table [dbo].[' + @tablename + ']{'
OPEN MyCursor
FETCH NEXT FROM MyCursor into @itemname,@itemtype
WHILE @@FETCH_STATUS = 0
BEGIN
set @sql = @sql + '[' + @itemname + ']['+ @itemtype + '],'
FETCH NEXT FROM MyCursor into @itemname,@itemtype
END