Column information in SQL
Dear Friends,
I want to know at runtime what is the total number of columns selected in a SELECT query as well as their names?
Please let me know if there is any method at all to accomplish this.
Thanks!
Yours truly,
Pankaj Dwivedi.
Is there an Oracle version involved in this question?
Why do you care? What are you going to do with this information if you have it?
The question generates more questions than answers without knowing more about what you are trying to do.
Similar Messages
-
I have an .XLSX File that I am trying to Upload into SQL Server. I use the Source as OLEDB Connection manager and pick OLDEB PROVIDER as MS OFFICE 12.0 ACCESS DATABASE ENGINE. In that I put this query but it gives the foll
error when I run the SSIS Package.
[OLE DB Source [1]] Error: No column information was returned by the SQL command.
Query I use in DATA FLOW TASK , IS SQL COMMAND:
Select top 1 [Investor #],[Investor Name], CONVERT (VARCHAR(1000),Delegation)AS DELEGATION ,[Date Added],[Date Revised] from [EXCELSHEET1$]
Any suggestion to fix this error? i have to do a convert since the excel datayype is DT_TEXT AND SQL TABLE DATATYPE is VARCHAR(1000) SO Have to do this Convert.If the target table's column is not a BLOB/CLOB (e.g. NVARCHAR(MAX)) and you have text longer than the max value it will not fit into the target, if you are allowed you need to trim it and convert, otherwise sure you get the error as the target datatype
is smaller.
Arthur My Blog -
Not getting column information while Function Import
i had followed below link
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/EntityFrameworkOBE/EntityFrameworkOBE.htm
i m successfully able to update and add recored using Entity framework into oracle DB.
now my problem is with Select SPS here i follwed all step from above link with sql db and i m able to get column informatin while same is not possible with oracle db.
the stored procedure returns a ref cursor, so we can create a new complex type by selecting "Get Column Information" then selecting "Create New Complex Type".
but i m not able to have enable button for create new complex type becuase get column not return anything.
i had created model or .edmx file and then go to model browser where i had list of stored procedure not by double click on sp we will get one dialog box for function import
over there when ever i select sp and then get colum information i m not able to find any thing ,,,, while sp is running fine i test that too using sql developer,,,
and yes i had created complex property tooo but that columns are also not coming.........
i m new to this please help me where i m lacking.
PLEASE
Reference copy of my SP
PROCEDURE GETPERSONDETAIL(curParam out sys_refcursor)
IS
BEGIN
OPEN curParam FOR
SELECT
FIRSTNAME,
GENDER_CODE,
BIRTH_DATE,
LASTNAME
FROM PERSON;
END;
this sp is simple select statement...
Edited by: 875347 on Jul 27, 2011 2:23 AM<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="HREntities" connectionString="metadata=res://*/HRModel.csdl|res://*/HRModel.ssdl|res://*/HRModel.msl;provider=Oracle.DataAccess.Client;provider connection string="DATA SOURCE=IRWORA;PASSWORD=irw#1234;PERSIST SECURITY INFO=True;USER ID=IRW01"" providerName="System.Data.EntityClient" /></connectionStrings>
i had taken same name as per link i.e. HREntities and HRModel all that
now pls check my settings are correct or not because my Datasource name is IRWORA and oracle username is irw01 so do i need to change that in baseschemaname which i defined as HR,,, and yes i put the same " do i need to change that i hav no idea for that .....
below is my app config for the same....
<oracle.dataaccess.client>
<settings>
<add name=""HR"."UPDATE_AND_RETURN_SALARY".RefCursor.NEW_SALARY" value="implicitRefCursor bindinfo='mode=Output'" />
<add name=""HR"."UPDATE_AND_RETURN_SALARY".RefCursorMetaData.NEW_SALARY.Column.0" value="implicitRefCursor metadata='ColumnName=FIRST_NAME;BaseColumnName=FIRST_NAME;BaseSchemaName=HR;BaseTableName=EMPLOYEES;NATIVE_DATA_TYPE=Varchar2;ProviderType=Varchar2;PROVIDER_DB_TYPE=String;ColumnSize=20'" />
<add name=""HR"."UPDATE_AND_RETURN_SALARY".RefCursorMetaData.NEW_SALARY.Column.1" value="implicitRefCursor metadata='ColumnName=SALARY;BaseColumnName=SALARY;BaseSchemaName=HR;BaseTableName=EMPLOYEES;NATIVE_DATA_TYPE=Number;ProviderType=Int32;DataType=System.Int32;ColumnSize=8'" />
</settings>
</oracle.dataaccess.client>
</configuration>
sorry i m very new to this ,,,,
please help me -
Error: unable to retrieve column information from the data source
Hi,
I am trying to set up a data flow task. The source is "SQL Command" which is
a stored procedure. The proc has a few temp tables that it outputs the final
resultset from. When I hit preview in the ole db source editor, I see the
right output. When I select the "Columns" tab on the right, the "Available
External Column List" is empty. Why don't the column names appear? What is
the work around to get the column mappings to work b/w source and
destination in this scenario.
In DTS previously, you could "fool" the package by first compiling the
stored procedure with hardcoded column names and dummy values, creating and
saving the package and finally changing the procedure back to the actual
output. As long as the columns remained the same, all would work.
Thats not working for me in SSIS.
Thanks in advance.
Asim.I had a similar problem retrieving column information when calling a stored procedure which returned a table declared as a variable within the procedure. I used "Command SQL" as data access within the OLE DB Source Editor, and "exec <sproc_name> <param_list>" as text for the SQL command.
After a few trials and errors, I noticed when I removed the IF statement that validated the parameter passed to the sproc it worked, i.e. SSIS could retrieve the column information, otherwise it wouldn't. Is it because of the IF, the BEGIN/END, or the RETURN? I do not know as I did not test further, but by removing the entire instruction block pasted below, it worked. Hope that it helps.
if @Reel_Ou_Budgete not in ('B', 'R')
begin
print 'Le paramètre de cette procédure stockée doit être B ou R.'
return -1
end -
How to export data with column headers in sql server 2008 with bcp command?
Hi all,
I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
am trying to import data with bcp command data has been copied but column names are not came.
I am using the below query:-
EXEC master..xp_cmdshell
'BCP "SELECT * FROM [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
Thanks,
SAAD.Hi All,
I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
DECLARE @BCPCMD
nvarchar(4000)
DECLARE @BCPCMD1
nvarchar(4000)
DECLARE @BCPCMD2
nvarchar(4000)
DECLARE @SQLEXPRESS
varchar(50)
DECLARE @filepath
nvarchar(150),@SQLServer
varchar(50)
SET @filepath
= N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
as varchar(4))
+RIGHT('00'+CAST(MONTH(GETDATE())
as varchar(2)),2)
+RIGHT('00'+CAST(DAY(GETDATE())
as varchar(2)),2)+'.log" '
Set @SQLServer
=(SELECT
@@SERVERNAME)
SELECT @BCPCMD1
= '''BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT '
SELECT @BCPCMD2
= '-c -t , -T -S '
+ @SQLServer +
SET @BCPCMD
= @BCPCMD1+ @filepath
+ @BCPCMD2
Print @BCPCMD
-- Print out below
'BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
EXEC
master..xp_cmdshell
@BCPCMD
''BCP' is not recognized as an internal or external command,
operable program or batch file.
NULL
if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
EXEC
master..xp_cmdshell
'BCP "SELECT * FROM
[tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
Thanks, SAAD. -
HELP! Is there a way to change column information in iTunes such as name of artist, genre etc, other than deleting them one at a time? Such as the way you delete an entire group of songs by holding down control keys or selecting the Select All command. Thanks.
If you select all the songs you want to change, Be it one song or an akbum, or an Artist, Or Genre, or playlist. Then Right mouse click and Get Info. You then get a slightly different from normal Get Info box as this is the One for Multiple items.
In there have a look at the tags and see if the one you want to changes is in there. There are a few tabs so if for example you wanted to change the Media Type from Home Movie to Movie go to the Options tab and select Movie and OK and it will change the whole selection. -
SP 2013 Server + Dec 2013 CU. Upgrading from SharePoint 2010.
We have a web application that is distributed over 7-8 content databases from SharePoint 2010. All but one database are upgradable. However, one database gives:
Invalid object name 'Webs'.
while running Test-SPContentDatabase or Mount-SPContentDatabase.
EventViewer has the following reporting 5586 event Id:
Unknown SQL Exception 208 occurred. Additional error information from SQL Server is included below.Invalid object name 'Webs'.
After searching a bit, these links do not help:
http://social.technet.microsoft.com/Forums/sharepoint/en-US/fd020a41-51e6-4a89-9d16-38bff9201241/invalid-object-name-webs?forum=sharepointadmin
we are trying PowerShell only.
http://blog.thefullcircle.com/2013/06/mount-spcontentdatabase-and-test-spcontentdatabase-fail-with-either-invalid-object-name-sites-or-webs/
In our case, these are content databases. This is validated from Central Admin.
http://sharepointjotter.blogspot.com/2012/08/sharepoint-2010-exception-invalid.html
Our's is SharePoint 2013
http://zimmergren.net/technical/findbestcontentdatabaseforsitecreation-problem-after-upgrading-to-sharepoint-2013-solution
Does not seem like the same exact problem.
Any additional input?
Thanks, Soumya | MCITP, SharePoint 2010Hi,
“All but one database are upgradable. However, one database gives:
Invalid object name 'Webs'.”
Did the sentence you mean only one database not upgrade to SharePoint 2013 and given the error?
One or more of the following might be the cause:
Insufficient SQL Server database permissions
SQL Server database is full
Incorrect MDAC version
SQL Server database not found
Incorrect version of SQL Server
SQL Server collation is not supported
Database is read-only
To resolve the issue, you can refer to the following article which contains the causes and resolutions.
http://technet.microsoft.com/en-us/library/ee513056(v=office.14).aspx
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jason Guo
TechNet Community Support -
How to show information from sql to flash cs6 in textbox
I am having trouble with the showing of result of the information from sql to flash cs6 textbox which is dynamic text.
I am using php to transfer the data to flash.
I will like to show me the information in order like
Name score
Tom 20
Jack 10
I already try reqVar.name + " " + reqVar.score and it does not work.
And there is also 6 data in the sql to be formated like the top.
function loginFunction(evt:MouseEvent):void
var variables:URLVariables;
var req:URLRequest;
var loader:URLLoader;
if (usertxt.text == "")
resTxt.text = "Please enter your username.";
return;
if (passtxt.text == "")
resTxt.text = "Please enter your password.";
return;
variables = new URLVariables();
variables.username = usertxt.text;
variables.password = MD5.hash(passtxt.text);
req = new URLRequest("http://localhost:8088/classP/checkLogin.php");
req.data = variables;
req.method = URLRequestMethod.POST;
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE,handleRes);
loader.load(req);
function handleRes(evt:Event):void
var loader:URLLoader;
var reqVar:URLVariables;
loader = URLLoader(evt.target);
reqVar = new URLVariables(loader.data);
if (reqVar.result == "PASS")
gotoAndStop(10);
var req:URLRequest;
req = new URLRequest("http://localhost:8088/classP/getScores.php");
req.method = URLRequestMethod.POST;
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE,handleRes3);
loader.load(req);
else
{resTxt.text = "Login Failed";}
function handleRes3(evt:Event):void //to show the output message when it is correct in user and pass
var loader:URLLoader;
var reqVar:URLVariables;
loader = URLLoader(evt.target);
reqVar = new URLVariables(loader.data);
displaytxt.text = reqVar.name + " " + reqVar.score;1.ckeck your syntax: the last two closing brackets are coming out of nowhere.
2.use trace commands in your eventhandlers to show if you get any results and if not use them as a hint where the error lies.
for example:
reqVar = new URLVariables(loader.data);
trace("reqVar:"+reqVar); -
SQL Query - The number of columns specified in "SQL Query" does not match t
I am creating new UDM for tablespace alert, below is my query,however its failing with error
SQL Query - The number of columns specified in "SQL Query" does not match the value specified in "SQL Query Output"
I selected Metric type is number
SQL Query Format : Two columns
Query:
SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2)
used_pct FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
Any clues why i am getting error.SQL> SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2) used_pct
2 FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
3 WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
4 AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
TABLESPACE_NAME USED_PCT
MGMT_TABLESPACE .82
SYSAUX 1.52
UNDOTBS1 .32
RMAN .02
CORRUPT_TS 10.63
USERS 0
SYSTEM 2.26
MGMT_ECM_DEPOT_TS .04
MGMT_AD4J_TS 0 -
Apex 4.0 display image item :BLOB column returned by SQL statement
Hello
I'm creating an display image item in apex 4.0. The source is a BLOB column returned by SQL statement.
When I'm issuing an sql statement like this:
select lado.blob_content
from large_documents lado
, large_doc_headers ladh
where lado.ladh_nr = ladh.nr
more criteriait works fine.
When I create a function inside a package with the same query (in a cursor)
function get_image(some parameters in) return blob
Following in apex by:
select get_image(some parameters) from dualI get a
ORA-06502: PL/SQL: numeric or value error: character string buffer too smallAnybody any idea why this does not work?
Regards ErikHi Eric,
the environment assumes varchar2-output by default, which will be limited to 32767 characters and may have problems with binary formats. You could define a blob-variable to select the value into.
DECLARE
l_blob BLOB;
BEGIN
SELECT get_image(some parameters)
INTO l_blob
FROM dual;
END;
/If you expect the BLOB-Content to be text (you should consider CLOB then), you may use UTL_RAW.CAST_TO_VARCHAR2 to convert the content. If your object is larger than the maximum varchar2 size, or you want to convert BLOB to CLOB, you might be interested in some converter like described here: {message:id=559749}
Hope this is what you were searching for.
-Udo -
JDBC receiver error:ORA-06550: line 1, column 7: PL/SQL
Hi,
I am geting this error in JDBC Receiver adapter. when i call the stored procedure.
Last week it works fine.But i today i faced this error.
Error Unable to execute statement for table or stored procedure. 'spec_utilities.SP_DELETE(Structure 'unassign') due to java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'SPEC_UTILITIES.SP_DELETE' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored
Error JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'spec_utilities.SP_DELETE(structure 'unassign'): java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'SPEC_UTILITIES.SP_DELETE' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored
Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'spec_utilities.SP_DELETE (structure 'unassign'): java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00201: identifier 'SPEC_UTILITIES.SP_DELETE'must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored
My stored procedure structure is:
<unassign>
<SP_DELETE action="EXECUTE">
<table>spec_utilities.SP_DELETE</table>
<PAE isInput="true" type="VARCHAR">447848</pAEIC>
<SKEY isInput="true" type="NUMERIC">4548545</pSKEY>
<USER isOutput="true" type="VARCHAR" />
<UNIT isOutput="true" type="VARCHAR" />
<EMAIL isOutput="true" type="VARCHAR" />
</SP_DELETE>
</unassign>
Can you suggest me where is this error.
Thank you
SateeshHi,
if it was executing fine earlier then check the below
1. user permissions level at the database..whether it has access to the required SP or not..
2. Check if there was any change in the SP..which has not been communicated...
HTH
Rajesh -
Display column name in sql*plus
Hi,
How to display full column name?
there are n no of tables, i have to query the tables but i want the column name to be displayed fully. for example
SQL> desc control
Name Null? Type
CODE NOT NULL VARCHAR2(255)
LOAD_PERIOD_START_DATETIME DATE
SQL> select code,load_period_start_datetime from control;
CODE
LOAD_PERIOD
AAA
01-AUG-2007
SQL> col load_period_start_datetime format a30
SQL> /
CODE
LOAD_PERIOD_START_DATETIME
AAA
01-AUG-2007
SQL>
As it is only one column i can set with 'col <column_name> format a 30'
if there are n no of coumns from n no tables then how do i get the full column name?
Please help me.
ThanksHi,
you can get all the column's for a TABLE from all_tab_columns this VIEW, why dont you write as script which will generate the commands.
Could you please tell us why do you want to display the compete COLUMN NAME in SQL plus.
Thanks -
What is LAST_ACTIVE_TIME column in v$sql view
Hi,
I am using Oracle 10.2.0.3 version.
I have a doubt in v$sql view.
What is the meaning of LAST_ACTIVE_TIME column in v$sql view?
I presume it is the latest time when this SQL was executed in the database. M I right?
As per Oracle docs it's definition is as below.
LASTACTIVE_TIME - Time at which the query plan was last active ._
Thanks in advance.
Best Regards,
oratestDear oratest,
Please see the following link;
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2113.htm#REFRN30246
+"+
+LAST_ACTIVE_TIME+
+DATE+
+Time at which the query plan was last active+
+"+
That is the time that the "query plan" active period. I think this could be as what you have said.
Regards.
Ogan
Edited by: Ogan Ozdogan on 30.Ağu.2010 22:21 -
How to show the VALUE as the Column Header using SQL query?
Hi
I have a requirement to show the picked value as the column header using SQL query.
Example:
======
SELECT EMPNO FROM EMP
WHERE EMPNO=7934;
Result Should be:
7934
7934I have a requirement to show the picked value as the column header using SQL query.In sql*plus you can do
SQL> set verify on
SQL> def e = 7934
old: SELECT empno "&&e" FROM emp WHERE empno = &&e
new: SELECT empno "7934" FROM emp WHERE empno = 7934
SQL> SELECT empno "7934" FROM emp WHERE empno = 7934
7934
7934
1 row selected. -
we formatted Database server and restored all the databases from the backup. but the sharepoint site is giving below error when i access the home page.
we have 3 application servers in that two are working fine, but only one server getting the below error.
SQL database login for 'SharePoint_Config_2010' on instance 'db server' failed. Additional error information from SQL Server is included below.
Login failed for user 'domain\user'.
could you help what is the issue?Hi,
According to your post, my understanding is that you failed to access sharepoint site with one application server.
It was due to the MOM/SCOM Agent that has a SharePoint management pack installed, the agents Windows Service runs as ‘Local System’ and thus causes this.
The workaround is to either kill the SCOM agent service, or set it to run as a dedicated service account.
In addtion, I recommend to add the logon account of the SharePoint Timer service as a user of the SharePoint_Config database. Give role membership to the account db_owner.
You also need to add the SharePoint accounts back into sql server.
There are some similar articles for you to take a look at:
http://blog.blksthl.com/2012/04/26/login-for-sharepoint_config-login-failed-for-user-domaincomputername-scom-agent/
http://msdn.microsoft.com/en-us/library/jj551781(v=nav.70).aspx
http://sharepoint.stackexchange.com/questions/51623/moved-sql-databases-for-sharepoint-2010-and-now-have-a-3351-error
Best Regards,
Linda Li
Linda Li
TechNet Community Support
Maybe you are looking for
-
hi all. sorry i just want some information in creation of data type which i svery ease to solve. and it is i had seen one data type which was creatd by my colleague and its haveing occurance 1..unbounded for some and 1..10 for remaining elements and
-
SELECTing from multiple rows and different tables
Basically, I have a table with a primary key and some other columns of data. The second table has a foreign key that points to the first table then has a columns with related data. I want to write construct a SQL query where one of the columns is the
-
Slow moving iPad 2 (kind of)
Hello I have an iPad 2 for 4 months now, and I've added several music, apps, videos and other media in the device. And I've realized last week that my iPad 2's startup (from sleep) / opening, is slow for my opinion (1 second just after clicking home
-
Pdfs taking 10-30 mins to open (75-150 pgs)
I just got acrobat XI pro so that i can send password protected pdf files. Now the same pdf files that used to take 10-30 seconds to open take 10-30 minutes!! What can I do to fix this?? Please help.
-
Consistent parameter in Data Pump.
Hi All, As we know that there is no consistent parameter is data pump, can any one tell me how DP takes care of this. From net i got the below one liner as Data Pump Export determines the current time and uses FLASHBACK_TIME .But I failed to understa