I have several columns with large amounts of data, I can see all the data in global environment but once it get to "write.xport" to export it to a xpt file it crashes.
The amount of data in each of the two columns are 2600 character
I would be extremely grateful for any help!!
SCRIPT
library(Hmisc)
library(RODBC)
library(SASxport)
library(haven)
Driver = paste("driver={ODBC Driver 17 for SQL Server}",
"server=system \MS_SQLEXPRESS",
"database=CheckData",
"UID=peas",
"PWD=corn",
sep=";")
conn<- odbcDriverConnect(Driver)
data <- sqlQuery(conn, paste("exec [dbo].[sp_Rtest]"))
write.xport(data, file=paste("C:\XPT\DmExtract.xpt"), verbose=TRUE,
sasVer="9.00",
cDate=Sys.time(),
formats=NULL,
autogen.formats=FALSE)
My Table
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Rtest](
[cola] [nvarchar] (4000) NULL,
[colb] [nvarchar] (4000) NULL
) ON [PRIMARY]
GO
My Stored Proc
/****** Object: StoredProcedure [dbo].[sp_Rtest] Script Date: 10/15/2021 5:28:33 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_Rtest]
AS
BEGIN
-- Insert statements for procedure here
SELECT CAST(cola AS nvarchar(4000)) as cola ,CAST(colb AS nvarchar(4000)) as colb FROM Rtest
END