0
RからSQLクエリを実行し、結果をデータフレームに取得したいと思います。ここに私の例があります。RからのSQLの実行
library(RODBC)
db.handle <-odbcDriverConnect('driver=
{SQL Server Native Client 11.0};server=some_server\\some_server_2;
database = some_db;trusted_connection=yes')
query <-"select top 10 * into #temp_table from table_A select * from #temp_table"
res <- sqlQuery(db.handle, query)
print(res)
上記コードはcharacter(0)
です。それは#temp_table
なしで動作します。それは一時テーブルで動作させる方法はありますか?
'from table_A'の後にセミコロンを入れてみましたか? –
@TimGoodmanここで私のクエリ 'IF OBJECT_ID( 'tempdb ..#temp1)IS NOT NULL DROP TABLE#temp1;を変更した方法です。 table_Aから#temp_tableにトップ10 *を選択します。 select * from#temp_table'私はまだ同じ 'character(0)'を持っています。 – user1700890