BookmarkSubscribeRSS Feed
jjmccoydk
Calcite | Level 5

Hey
I have problem with this variale.

 

I want to use a transformation in Data stadio to automate loading til MS SQL with long table names.

 

I get this error.

ERROR: CLI execute error: [SAS][ODBC 20101 driver][Microsoft SQL Server]Invalid object name '[Mellemkommunal Odense$OSR Vendor
No_]'.
 

The problem is single quote, when i am using the variable. 

then i write the table name in the cod

execute (
delete
from [Mellemkommunal Odense$OSR Vendor No_]

No problems.

 

Any suggestion

 

LIBNAME xpophona BASE "!SAS_DATA/6_eksport/opholdsbetaling_navision/data";


/* Access the data for EXT Opholdsbetaling Navision Write odbc  */ 
LIBNAME x_ophnaw ODBC  DATAsrc=EXT_Opholdsbetaling_Navision_W  SCHEMA=dbo ;
/* code options in the transformation*/
%let SQL_table =%nrqoute([Mellemkommunal Odense$OSR Vendor No_]); /*automatic generated by the transformation*/
%let SQL_columns = %nrquote([VAT Registration No_],[OSR Vendor No_],[OSR Vendor Name],[B-Taxable]);/*automatic generated by the transformation*/

--------------------------------------------------------*/
/*1) Def. of variables                                                                          */
/*---------------------------------------------------------------------------------------------*/
%put &=SQL_table;
%put &=SQL_columns;

proc sql;
	connect to odbc (DATAsrc=EXT_Opholdsbetaling_Navision AUTHDOMAIN="AuthDom MSSQL sasbatch");

	execute (
			delete	   
			from "&SQL_table"
			)
			by odbc;
disconnect to odbc;
quit;

 

2 REPLIES 2
Ksharp
Super User
1) Try libname 's option preserve_table_name=yes
2) Let DB create a view to correct this >32 table name ?
jjmccoydk
Calcite | Level 5

hey

 

1) 

preserve_tab_names=yes

I have the same problem.

 

2) It is not an option , bacause tablename is defined by Microsoft Business Central.

help

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 865 views
  • 0 likes
  • 2 in conversation