Distribute column
Hi,
Anyone having script for the below requirement:
For all tables, from second column onwards distribute the column width into "6p" (first column width variable). and also tables need to be fit (100%) with in the text margin.
Regards,
Velu
Try now, it will run on all the tables.
var doc = app.activeDocument,
_tables = doc.stories.everyItem().tables.everyItem().getElements(),
w = doc.documentPreferences.pageWidth;
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.picas;
doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.picas;
for(var i =0;i<_tables.length;i++)
for(var j =_tables[i].columns.length-1;j>0;j--)
_tables[i].columns[j].width = "6P";
var _left = _tables[i].parent.parentPage.marginPreferences.left,
_right = _tables[i].parent.parentPage.marginPreferences.right;
try
_tables[i].columns[0].width = (w - (_left + _right)) - (_tables[i].columns.length-1)*6 ;
catch(e)
alert("Table width exeeds the length of the text area!")
Regards,
Chinna
Similar Messages
-
Table Issue: Cannot Distribute Columns Evenly
I have a 3x3 matrix that does not Distribute Columns Evenly when the action is performed. It spaces the columns asymmetrically causing the content to fall off the page. I checked and rechecked all of my formating (tabs, alignment, etc...) and settings. Any suggestions?
jonathan3 wrote:
My question is whether this option is perhaps a configuration issue, a bug, or something that I'm missing. Since you already figured out that you can use an alias one can suppose that it is the last in that you are missing that you already have a solution.
You can try extracting the meta data to see if it has a name without the alias. Probably not.
Also, I would like to know if anybody has an elegant workaround without accessing columns using their numeric index.One can only suppose that you consider using names "elegant". -
Wrong values in distributed column in CJ40
Hi experts,
I am carrying out cost element planning in CJ40 against one child level wbs (level-2)and
also the cost is flowing from cProject to another child level wbs(level-2).
But after saving the costing data distributed amount at the parenet level WBS should be sum of two individual WBS element cost.
But here in my case , system is showing the cost element data in distributed column and not considering the cost whic flows to costing column and this amount is shown in distributable column.
can anybdy suggest any solutn for the same.
Regards
AshisHi Ashis,
This is the standard behaviour. It is similar you plan costs in PS using easy cost planning. You can see yoou cost total up or in a report or go to CJ20N -->open your project --> SHIFT + F11
Regards,
sara -
Selecting /distributing column values
PQR A B C D E
AA 1 2 3 4
BB 1
CC 1 2 3
DD 1 2 3 4 5
EE 1 2
six columns PQR, A B C D E
Here in this table AA is a combination of 1 2 3 4 , similarly BB is 1 , CC is a combination 1 2 3 , DD is a combination of 1 2 3 4 5 , EE is a combination of 1 2
My new table will have a two columns PQR and ZZ with these values .
My final table will look like this , with all the combination values under a single column ZZ .
PQR ZZ
AA 1,2,3,4
BB 1
CC 1,2,3
DD 1,2,3,4,5
EE 1,2
How should the query be if I have to list each of these combination values under a single column and get rid of columns B C D E .
The resulting table should be in this order with 2 columns PQR and A
PQR A
AA 1
AA 2
AA 3
AA 4
BB 1
CC 1
CC 2
CC 3
DD 1
DD 2
DD 3
DD 4
DD 5
EE 1
EE 2
Any takers please.Hi,
Type {code} (all small letters, between curly brackets) before and after tabular data when posting on this site, to preserve spacing.
I think what you want is:
SELECT SUBSTR ( CASE WHEN a IS NOT NULL THEN ',' || a END
|| CASE WHEN b IS NOT NULL THEN ',' || b END
|| CASE WHEN c IS NOT NULL THEN ',' || c END
|| CASE WHEN d IS NOT NULL THEN ',' || d END
|| CASE WHEN e IS NOT NULL THEN ',' || e END
, 2
FROM table_x;The CASE staements add only the items that are in the table, each preceeded by a comma. That keeps you from getting multiple commas when multiple columns are NULL.
SUBSTR removes the comma before the first item.
Edited by: Frank Kulash on Feb 4, 2009 5:13 PM -
Hi,
sitting on this already few hours - what am I doing wrong?
I'm trying to evenly distribute columns in a table (_tb) using folowing line, but table stays unaffected
(I properly addressed table everything else is working just fine)
_tb.columns.everyItem().redistribute(HorizontalOrVertical.HORIZONTAL);
any idea to evenly distribute rows/columns in a table
(same as Menu Command: Table->Distribute Columns Evenly)?
thanks
smok
PS.
simple workaround was :
colLgth = _tb.columns.length;
wdth = _tb.width;
_wdth = wdth/colLgth;
_tb.columns.everyItem().width = _wdth;
but I would like to do it in one line without math and using command "redistribute"
thnks
smoktb.columns[0].redistribute (HorizontalOrVertical.VERTICAL, tb.rows[0]);
What your own attempt probably did -- and without saying so -- was something like "distribute width of one single column", which indeed does not make sense.
Somehow I also wouldn't have thought "VERTICAL" is correct here But it failed with HORIZONTAL, and now the Undo menu says "Undo Distribute Columns Evenly" so I guess that's what it takes. -
Tables with differing numbers of columns in subsequent rows
I'm trying to create a table that has say 3 columns in row one, 2 columns in row two, 5 columns in row 5. I've done it so far by merging cells and splitting them and then asking it to distribute columns evenly but the columns are not distributed evenly.
The column width button is greyed out so I can't set the width manually and so my table looks really unprofessional.
Is there a better way of creating such a table and getting equally distributed columns?
Many thanks
sekentiousan example of merging cells is here
[http://www.crionics.com/products/opensource/faq/swing_ex/JTableExamples4.html]
scroll down to 'Multi-Span Cell'
run the program, highlight some cells, click combine.
if that's the type of thing you're after, modify your code per what's in 'combine'
note: the original code (now) produces a stack overflow error (don't know if it's been fixed in the above link),
but if you get that error, in AttributiveCellTableModel's setDataVector( Vector newData, Vector columnNames )
change
setColumnIdentifiers(columnNames);
to
columnIdentifiers = columnNames; -
Equal space for Table column Gutter?
Hi All,
I want to make the tables column between space equally by using the Scripting (InDesign CS5.5 Windows). I'm stuggled in creating the algorithm to this task. Is any one already completed this type of automation means please share your thoughts, or please suggest the algorithm you are using.?
Thanks in Advance.
Regards,
Imagine.In the above snapshot In between columns are having the uneven spaces. I need to give the even space between columns based on the maximum characters on that columns.
Do you mean the equivalent of Table > Distribute Columns Evenly?
No. -
CS2 automatically fit row height to content in table?
Hi guys, I'm using CS2 and I have a table with lots of pages. I need to be able to have the height automatically fit to the content of the tables. Unfortunately data is not consistent therefore some cells have 2 rows of content, others 8.
Automatically fit to content is not available.
I have tried adjusting row heights then 'table' > 'distribute rows evenly' but obviously this is no good as some are too cluttered, others too spacious.
Any suggestions appreciated.Huh. Maybe I read the OP's posts correctly, I think, but I misread yours. I assumed that, since the thread-opener mentioned row height, that when the OP asked about getting rid of "distribute evenly" that row height was still under discussion. Looks to me like all you can do with cell width/column width is
1) Select a column and specify an exact width
2) Select a group of columns and specify the same exact width for all of 'em
3) Select all the columns and
a) Distribute columns evenly
b) Specify an exact width for all columns
Unfortunately, I have to use tables a great deal, so I feel like I'm up to speed on what we can and cannot do with ID tables. -
Table text frame width adjustment by script
Hi,
I have to capture my table cells within ‘Text Frame Width’ option with ‘Distribute Column Evenly’ , when it’s going to beyond the ‘Text Frame Width’. Is this possible by script?
by
hasviHi Hasvi,
Try this.
var doc = app.activeDocument,
_tables = doc.stories.everyItem().tables.everyItem().getElements(),
_tfwidth, _cells, finalwidthofcell;
for(var i =0;i<_tables.length;i++)
var currentwidth = 0;
_tfwidth = _tables[i].parent.geometricBounds[3] - _tables[i].parent.geometricBounds[1];
_cells = _tables[i].rows[0].cells;
for(var j=0;j<_cells.length;j++)
currentwidth +=_cells[j].width;
if(currentwidth > _tfwidth)
finalwidthofcell = _tfwidth/_cells.length;
for(var k=0;k<_cells.length;k++)
_cells[k].width =finalwidthofcell;
Regards,
Chinna -
Hi All,
Please any one give me the information about the T code IM53 in that t code one column *Distributed * column please give me that column table name.
Regards,
SeemaHi Alex,
Thanks
Regards,
seema -
Cannot Paste Duration data--format changes upon Paste!
I'm pasting some tabular data and one column is Duration (Ex: 01:19:00) and when I paste the data in values like 01:19:00 become 1:19 AM.
I need the actual durations so they can be computed.... how can I get Numbers to stop automatically changing these values???
Thanks,
RobertFor those which don't want to pre-format a table, I wrote this script which protect the durations.
CAUTION :
as the developers forgot to include duration in the list of formats settable thru AppleScript, I apply the format text. You will have to change it to duration 0:00:00.
--[SCRIPT iTunestoNumbers]
Enregistrer le script en tant que Script : iTunestoNumbers.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Copier des données dans iTunes. Si elles contiennent des durées,
aller au menu Scripts , choisir Numbers puis choisir “iTunestoNumbers”
Le script les colle dans une table d'un nouveau document Numbers
dont certaines colonnes sont définies au format texte pour préserver les dites durées.
Il vous faudra retoucher le format en spécifiant durée, 0:00:00 dans l'Inspecteur de cellules.
Je suis désolé mais les dévelopeurs ont oublié d'inclure durée dans les formats applicables à l’aide d’AppleScript.
--=====
L’aide du Finder explique:
L’Utilitaire AppleScript permet d’activer le Menu des scripts :
Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case “Afficher le menu des scripts dans la barre de menus”.
Sous 10.6.x,
aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
--=====
Save the script as a Script: iTunestoNumbers.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Copy datas from iTunes. If they contain durations,
go to the Scripts Menu, choose Numbers, then choose “iTunestoNumbers”
The script will paste the datas in a Numbers new table
whose some columns are defined as text to protect the duration entries.
You will have to adjust the format to duration 0:00:00 thru the Inspector of Cells.
I apologize but the develpers forgot to include duration in the list of formats settable thru AppleScript.
--=====
The Finder’s Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the “Show Script Menu in menu bar” checkbox.
Under 10.6.x,
go to the General panel of AppleScript Editor’s Preferences dialog box
and check the “Show Script menu in menu bar” option.
--=====
Yvan KOENIG (VALLAURIS, France)
2011/03/24
--=====
on run
run script doyourduty
--my doyourduty()
end run
--=====
script doyourduty
-- on doyourduty()
local le_fichier, en_liste, ligne_10, nb_colonnes, colonnesdedurees, c, item_c
local format_duree, j, r, une_ligne, en_texte, myNewDoc, n_colonnes, nb_colonnes
my activateGUIscripting()
Extract the datas from the clipboard.
set en_liste to paragraphs of (the clipboard as text)
Search values containing durations to be able to apply the format duration to their columns.
set ligne_10 to my decoupe(item 10 of en_liste, tab)
set nb_colonnes to count of ligne_10
set colonnesdedurees to {}
repeat with c from 1 to nb_colonnes
set item_c to item c of ligne_10
if item_c contains ":" then
set format_duree to true
repeat with j from 1 to count of item_c
if character j of item_c is not in {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":"} then
set format_duree to false
exit repeat
end if
end repeat -- with j
if format_duree then copy c to end of colonnesdedurees
end if -- item_c contains…
end repeat -- with i
Create a new Numbers document from the Apple's Blank template.
set myNewDoc to my makeAnIworkDoc("Numbers")
tell application "Numbers" to tell document myNewDoc to tell sheet 1 to tell table 1
Remove header row and header column.
remove row 1
remove column 1
Insert the required columns.
set n_colonnes to count column
repeat nb_colonnes - n_colonnes times
add column after last column
end repeat
Define the format of columns which must be set to text.
if colonnesdedurees is not {} then
repeat with c from 1 to count of colonnesdedurees
set une_colonne to item c of colonnesdedurees
set format of range ((name of cell 1 of column une_colonne) & ":" & (name of cell -1 of column une_colonne)) to text
end repeat
end if -- colonnesdedurees is not {}…
Define the first cell to paste in.
set selection range to range "A1"
end tell -- Numbers
Concatenate the rows with carriage return as separators. Pass the result to the clipboard.
set the clipboard to my recolle(en_liste, return)
with timeout of (10 * 60) seconds
my raccourci("Numbers", "v", "cas") (* Paste and Match Style *)
end timeout
Select every cells except the column 1.
tell application "Numbers" to tell document myNewDoc to tell sheet 1 to tell table 1
set selection range to range ("A1:" & name of last cell)
end tell -- Numbers
As there is no shortcut, trigger the menu item itself.
my select_menu("Numbers", 6, 17) (* Table > Resize Columns to Fit Contents *)
if colonnesdedurees is not {} then
set colonnesde_dureestext to my recolle(colonnesdedurees, ", ")
tell application "Numbers"
if not my parleAnglais() then
if (count of colonnesdedurees) = 1 then
display dialog "Don’t forget to set the format" & return & "of column “" & colonnesdedurees & "” to duration 0:00:00 !"
else
display dialog "Don’t forget to set the format" & return & "of columns “" & my recolle(colonnesdedurees, ", ") & "” to duration 0:00:00 !"
end if -- (count of colonnesdedurees)…
else
if (count of colonnesdedurees) = 1 then
display dialog "N'oubliez pas de fixer le format" & return & "de la colonne « " & colonnesdedurees & " » à durée 0:00:00 !"
else
display dialog "N'oubliez pas de fixer le format" & return & "des colonnes « " & my recolle(colonnesdedurees, ", ") & " » à durée 0:00:00 !"
end if -- (count of colonnesdedurees)…
end if -- parleAnglais{}
end tell
end if -- colonnesdedurees is not {}…
-- end doyourduty
end script
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
on decoupe(t, d)
local oTIDs, l
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to oTIDs
return l
end decoupe
--=====
on recolle(l, d)
local oTIDs, t
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set t to l as text
set AppleScript's text item delimiters to oTIDs
return t
end recolle
--=====
removes every occurences of d in text t
on supprime(t, d)
local oTIDs, l
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
set t to l as text
set AppleScript's text item delimiters to oTIDs
return t
end supprime
--=====
Creates a new iWork document from the Blank template and returns its name.
example:
set myNewDoc to my makeAnIworkDoc(theApp)
on makeAnIworkDoc(the_app)
local maybe, pathto_theApp, nb_doc, doc_name
if the_app is "Pages" then
tell application "Pages"
set nb_doc to count of documents
make new document with properties {template name:item 1 of templates}
end tell
else if the_app is "Numbers" then
tell application "System Events" to set maybe to the_app is in title of every application process
if not maybe then tell application the_app to activate
tell application "System Events"
set pathto_theApp to get application file of application process the_app
end tell
tell application "Numbers"
set nb_doc to count of documents
open ((pathto_theApp as text) & "Contents:Resources:Templates:Blank.nmbtemplate:")
end tell
else
if my parleAnglais(the_app) then
error "The application “" & the_app & "“ is not accepted !"
else
error "l’application « " & the_app & " » n’est pas gérée !"
end if
end if
tell application the_app
repeat until (count of documents) > nb_doc
delay 0.1
end repeat
set doc_name to name of document 1
end tell -- the_App
return doc_name
end makeAnIworkDoc
--=====
on activateGUIscripting()
(* to be sure than GUI scripting will be active *)
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true
end tell
end activateGUIscripting
--=====
==== Uses GUIscripting ====
This handler may be used to 'type' text, invisible characters if the third parameter is an empty string.
It may be used to 'type' keyboard raccourcis if the third parameter describe the required modifier keys.
I changed its name « shortcut » to « raccourci » to get rid of a name conflict in Smile.
on raccourci(a, t, d)
local k
tell application a to activate
tell application "System Events" to tell application process a
set frontmost to true
try
t * 1
if d is "" then
key code t
else if d is "c" then
key code t using {command down}
else if d is "a" then
key code t using {option down}
else if d is "k" then
key code t using {control down}
else if d is "s" then
key code t using {shift down}
else if d is in {"ac", "ca"} then
key code t using {command down, option down}
else if d is in {"as", "sa"} then
key code t using {shift down, option down}
else if d is in {"sc", "cs"} then
key code t using {command down, shift down}
else if d is in {"kc", "ck"} then
key code t using {command down, control down}
else if d is in {"ks", "sk"} then
key code t using {shift down, control down}
else if (d contains "c") and (d contains "s") and d contains "k" then
key code t using {command down, shift down, control down}
else if (d contains "c") and (d contains "s") and d contains "a" then
key code t using {command down, shift down, option down}
end if
on error
repeat with k in t
if d is "" then
keystroke (k as text)
else if d is "c" then
keystroke (k as text) using {command down}
else if d is "a" then
keystroke k using {option down}
else if d is "k" then
keystroke (k as text) using {control down}
else if d is "s" then
keystroke k using {shift down}
else if d is in {"ac", "ca"} then
keystroke (k as text) using {command down, option down}
else if d is in {"as", "sa"} then
keystroke (k as text) using {shift down, option down}
else if d is in {"sc", "cs"} then
keystroke (k as text) using {command down, shift down}
else if d is in {"kc", "ck"} then
keystroke (k as text) using {command down, control down}
else if d is in {"ks", "sk"} then
keystroke (k as text) using {shift down, control down}
else if (d contains "c") and (d contains "s") and d contains "k" then
keystroke (k as text) using {command down, shift down, control down}
else if (d contains "c") and (d contains "s") and d contains "a" then
keystroke (k as text) using {command down, shift down, option down}
end if
end repeat
end try
end tell
end raccourci
--=====
my selectMenu("Numbers",6, 17) (* Table > Resize Columns to Fit Contents *)
==== Uses GUIscripting ====
on selectMenu(theApp, mt, mi)
tell application theApp
activate
tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
tell menu bar item mt to tell menu 1 to click menu item mi
end tell -- application theApp
end selectMenu
--=====
useful to get the indexs of the triggered item
my select_Menu("Numbers",6, 17) (* Table > Resize Columns to Fit Contents *)
on select_menu(theApp, mt, mi)
tell application theApp
activate
tell application "System Events" to tell (first process whose title is theApp) to tell menu bar 1
get name of menu bar items
01 - "Apple",
02 - "Numbers",
03 - "File",
04 - "Edit",
05 - "Insert",
06 - "Table",
07 - "Format",
08 - "Arrange",
09 - "View",
10 - "Window",
11 - "Share",
12 - "Help"}
get name of menu bar item mt
-- {"Table"}
tell menu bar item mt to tell menu 1
get name of menu items
01 - "Add Row Above",
02 - "Add Row Below",
03 - missing value
04 - "Add Column Before",
05 - "Add Column After",
06 - missing value,
07 - "Delete Row",
08 - "Delete Column",
09 - missing value,
10 - "Header Rows",
11 - "Header Columns",
12 - "Freeze Header Rows",
13 - "Freeze Header Columns",
14 - "Footer Rows",
15 - missing value,
16 - "Resize Rows to Fit Content",
17 - "Resize Columns to Fit Content",
18 - missing value,
19 - "Unhide All Rows",
20 - "Unhide All Columns",
21 - "Enable All Categories",
22 - missing value,
23 - "Merge Cells",
24 - "Split into Rows"
25 - "Split into Columns"
26 - missing value
27 - "Distribute Rows Evenly"
28 - "Distribute Columns Evenly"
29 - missing value
30 - "Allow Border Selection"
31 - missing value
32 - "Show Reorganize Panel"}
get name of menu item mi
--{"Resize Columns to Fit Content"}
click menu item mi
end tell -- menu bar item…
end tell -- System Events…
end tell -- application theApp
end select_menu
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) jeudi 24 mars 2011 17:08:42 -
Is there a way to insert a real page break into multi-pages sheets like in Excel? I have not found a way to do this or a work around apart from inserting multiple rows.
you may not have same problem
my columns stuck out over what used to be a page break
so I fit columns to data starting from the right most column
until all the columns I wanted were on one sheet
then there is a Distribute columns evenly (or something like that)
that spread the columns to evenly fill out page.
Not complete control
but at least my pages started on the column I wanted -
Distribute Reports to Blob Column
Is it possible to distribute BI Publisher reports to a blob column? I would like this feature for my scheduled reports.
Regards,
ToddThanks for the replies,
I'm not familiar with these solutions, so I will need to research...
I would like to have my application users submit BIP reports to the BIP scheduler. Then once the BIP reports are distributed to a blob column (in a table I define). The application users could then retrieve their reports from the blob column...
I like the idea of having the report in a blob column as it simplifies my application security. I can control my application security through the database. Having the report stored in the database along with security logic also enables my application to show the user only the reports they've run...
Thanks,
Todd -
Hiding columns/fields in the response portfolio after you distribute your form
I have a 10 page from that has about 100 radio buttons (yes/no) in it. After someone submits the form and I open my response portfolio the only columns/fields I want to see is the name, date, age and exclude all the radio buttons. Can you set an option LC ES before you distribute the form?
I have found I can do this within the portfolio pdf, but only going to modify---view-then unchecking what I do not want to see…………BUT it is ONLY one at a time. If there is another way of doing it LET ME KNOW!!
Thanks
mikeThe response file is a collection. But unfortunately it can't be edited, at least not easily. You can remove a column with a script run in the console window.
this.collection.removeField("FieldName");
The field name is typically the name displayed at the top of the column.
Thom Parker
The source for PDF Scripting Info
pdfscripting.com
The Acrobat JavaScript Reference, Use it Early and Often
Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article) -
Hi,
Can anyone help me out please.
I have written one stored Procedure to create a views using Openrowset(openquery) but for tables which contains xml data types throwing error while executing the SP. Error
" Xml data type is not supported in distributed queries. Remote object 'OPENROWSET' has xml column(s)."
Please refer the Stored Procedure & error message below.
USE [Ice]
GO
/****** Object: StoredProcedure [dbo].[Pr_DBAccess] Script Date: 08/14/2014 16:08:20 ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
ALTER
PROCEDURE [dbo].[ Pr_DBAccess](@SERVERTYPE
NVARCHAR(50),@SERVERNAME
NVARCHAR(100),@DATABASENAME
NVARCHAR(100),@SCHEMANAME
NVARCHAR(100),@TABLENAME
NVARCHAR(100),@USERNAME
NVARCHAR(100),@PASSWORD
NVARCHAR(100))
AS
BEGIN
DECLARE @openquery
NVARCHAR(4000),
@ETL_CONFIG_IDN
NVARCHAR(100);
IF @SERVERTYPE='SQL'
BEGIN
SET @openquery=
'CREATE VIEW '+@TABLENAME+
' WITH ENCRYPTION AS SELECT * FROM OPENROWSET(''SQLNCLI'',''SERVER='+@SERVERNAME+';TRUSTED_CONNECTION=YES;'',''SELECT * FROM '+@DATABASENAME+'.'+@SCHEMANAME+'.'+@TABLENAME+''')'
SELECT @openquery
END
EXECUTE
sp_executesql @openquery
END
----While running the SP manually below error occuredHI ,
1. You cannot use a table or view that contains xml or clr type as 4-part name in your query
2. You need to cast the column to either nvarchar(max) or varbinary(max) or other appropriate type to use
3. If you have a table that has xml type for example then you need to create a view that contains all columns other than xml and query it instead. Or you can issue a pass-through query using OPEN QUERY with the appropriate columns only.
Here is a work around:
SELECT
Cast(a.XML_Data as XML) as XML_Data
FROM
OPENQUERY([LINKED SERVER NAME HERE],'
SELECT
Cast(XML_Data as Varchar) as XML_Data
FROM
[DATABASE NAME].[SCHEMA].[TABLE NAME]'
) a
Basically, the data is queried on the remote server, converts the XML data to a varchar, sends the data to the requesting server and then reconverts it back to XML.
You can take help from below link;
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c6e0f4da-821f-4ba2-9b01-c141744076ef/xml-data-type-not-supported-in-distributed-queries?forum=transactsql
Thanks
Maybe you are looking for
-
Dear All, I have installed Oracle 10g 32-bit on Windows 7 64-bit Ultimate Edition. After setting ORACLE_HOME and ORACLE_SID environment variables. Oracle connected to sqlplus fine. But when starting Enterprise Manager in browser following error displ
-
I cant print. My computer tells me I am not connected. I was able to take a test.Myprinter just repaired. and I installed the printr disc again . Any suggestios?
-
What can be done when Cold Fusion 9 ODBC Services will not install?
What can be done when 64-bit Cold Fusion 9 ODBC Service will not install on a Windows Server 2008-R2 64-bit machine? Yes, most of the things in other discussions have been tried.
-
shortly I decided to switch from bibble labs software to LR. There's one thing i cannot find. After I worked on all my files I want to make virtual copies to set the files into black and white so i can do some extra adjustments typical for B&W and k
-
If I set up my iPhone as new will it reset my phone?
If I set up my iPhone as new will it reset my phone?