Cannot Copy Field Names In Column Headings From View Results

Jan 8, 2007

When I am using a SQL Query I have an ability to control whether or not I am able to Include the Column Headers when copying or saving results.

The control exists in the Options > Query Results > Results to Grid > Include column headings etc.

My question is how to get this same ability when attempting to copy the results of a VIEW vs. a Query.
The idea is that when I setup a view it€™s a drag/drop type of query building (query building for dummies if you will). Once I have a view and click the Execute icon it will return all the records selected by the View. However, when I click the upper left/top box to select all rows and column and then try to copy/paste the records into Excel all the data copies just fine but the field name/column headers are not there.
How can I get the header fieldname date to copy/paste from View result set that I'm able to copy from a Query result set?
Thank you,
Mike

View 1 Replies


ADVERTISEMENT

Cannot Copy Column Names View Result Set

Feb 10, 2007

In SQL 2005 - when I display the results of a View and Copy all rows and columns, the resulting Paste in Excel does not include the column names.

How can I set SQL 2005 so the names of the columns will come along with the content of the copy function?

Background:

When I am using a SQL Query (instead of a view) I have the ability to control whether or not I am able to Include the Column Headers when copying or saving results. The control exists in the Options > Query Results > Results to Grid > Include column headings etc.

My question is how to get this same ability when attempting to copy the results of a VIEW vs. a Query.

Thank you,
Poppa Mike

View 3 Replies View Related

Copy/paste Grid From QA - No Field Names!

Nov 23, 2004

for debug purposes i tried to copy paste some Query Analyser output into Excel... the data pastes fine, but i can't get the field-names to copy/paste. is there a trick? izy

View 3 Replies View Related

Store Procedure To Copy View Results To A Table

Feb 17, 2014

I am looking for an example of a store procedure that will run a existing view and copy the results to a table. Every time it runs the table needs to be truncated. Will run once a day.

My view is a follows

SELECT PClass
FROM mydatabase.dbo.ProductClassDes
WHERE (ProductClass <> '_RBS') AND (ProductClass <> '_EDT') AND (ProductClass <> '_BMS') AND (ProductClass <> '_PAZ') AND (ProductClass <> '_PBC')

View results need to be copied to a table tblCurrentProductClasses that will only contain one field PClass.

View 2 Replies View Related

How To Retrieve Query Results With Now Field Names, Dotted Line Or Footer

Oct 5, 2006

Hi folks,I'm trying to write a simple SELECT statement that will execute inquery analyser but will just have the data with no column names, or thedotted line between them and the data. I also want to avoid thestatement at the end which says nnn rows affected. any ideas? I want todo this because I intend to write the results to a flat file.Thanks for your helpDanny....

View 2 Replies View Related

Make A View With Column Names From Row Values

May 22, 2008

Hi,

I have a table of results for various measured quantites and i need to turn this into a view. Only problem is i need to seperate the measured quantities and their respective values into seperate columns.

At the moment I have something like:

Quantity : Value
--------------------
Quantity 1 : 0.12
Quantity 1 : 0.56
Quantity 2 : 2.36
Quantity 2 : 5.34
Quantity 2 : 4.13
Quantity 3 : 10
Quantity 3 : 15

and I need a view that looks like:

Quantity 1 : Quantity 2 : Quantity 3
-------------------------------------
0.12 : 2.36 : 10
0.56 : 5.34 : 15
null(?) : 4.13 : null(?)

I've tried using pivots but they don't seem to help

Any ideas?

View 7 Replies View Related

Copy Table Column Names From SSMS Object Browser To Use In A Query

Nov 6, 2007

I thought I saw this done once before. So today I hunted around inBooks OnLine and did a Google search. So far I have found nothingclose. So if you know how to do it, please tell me or if cannot bedone, I'd appreciate know that too.Thanks in advance,IanO

View 2 Replies View Related

How To Change Column Names In The Grid View Programatically?

Aug 31, 2007

I have consistent column names that load into a grid view. I now need to change the names in the grid view programatically. I was originally trying to get cute with SQL to do this, but I've been told my below solution will not work and I'm better off to do this in the presentation layer.  If this is true, remember I'm still wet behind the ears here...how do I do this in vs2005?
Here's my post to the SQL devs to give you an idea what I'm trying to do.
I have a query that grabs fields from a denormalized table. The result is column names Week1, Week2, Week3....Week26.  Users want to see the actual date instead of Week#. So I have a table (lkpdatecaptions ) that contains the fields "fldfieldno" and "Fldcaption". fldfieldno    Fldcaption-----------  --------------11             9/07/200712             9/14/200713            9/21/2007So fieldno 11 represent week1 and so on. So my hope is to update the alias with a query like: Select fldcaption from forecast.tlkpdatecaptionswhere fldfieldno = 11That quey returns the value of 9/7/2007 and is the value I need to represent the coumn alias name.My current query looks like this:SELECT  SUM(forecast.tblforecastdenormalized.fldwk01) AS WEEK1,So can I do something like the following?SELECT  SUM(forecast.tblforecastdenormalized.fldwk01) AS (Select forecast.tlkpdatecaptions.fldcaption from forecast.tlkpdatecaptions where fldfieldno = 11), ...

View 6 Replies View Related

CREATE VIEW - Script To Automate Column Names?

Mar 14, 2007

Hi,I'm trying to create views on all my existing tables and for that I'dlike to create a script or so.I don't want to specify the '*' for the columns in the create viewstatement. I prefer to specify the column names.I have the column names int sys.columns table but Do not know how tohandle them to have a statement like that:CREATE VIEW myVIEWWITH SCHEMABINDINGASSELECT col1name, col2name, col3name, etc...from sys.columns....?????.....Anyone can help?thx,Chris

View 1 Replies View Related

Sending User Defined Column Names To A View

Oct 19, 2006

I want to pass user-defined column names to views or procedures



I am using SQL Server 2005 Express.



I tried this.



CREATE PROCEDURE @userDefinedColumn varChar(10) = 'My_Column'

select @userDefinedColumn, count(ID) as [Total Records] from My_Table

GROUP BY @userDefinedColumn



This was not accepted. It won't allow a user defined parameter in the group by.



But I need to pass user defined parameters to views as well.

View 5 Replies View Related

Get Field Headings?

Mar 17, 2004

I use the following to get the column names from a table but it is giving the error "Incorrect syntax near the keyword 'Where'"

Here is the Stored Proc:

CREATE PROCEDURE usp_GetTemplatePrompts

@cCode varchar(5)

AS

declare @cTableName varchar(100), @iError int, @cError varchar(255)

SELECT @cTableName = s.TableName
FROM tbShapes AS s INNER JOIN tbProductCodes AS pc
ON s.Shape = pc.fkShape
WHERE pc.Code = @cCode

SELECT @iError = @@Error
if(@iError = 0)
BEGIN
EXEC('SELECT * FROM ' + @cTableName + ' WHERE Template = 0')
SELECT @iError = @@Error
END

if(@iError <> 0)
BEGIN
set @cError = 'Error while attempting to get input fields for product ' + @cCode + '.'
RAISERROR(@cError, 16, 1)
END
GO


The table structure is as follows:


tbProductAccounts
Account (PK) | Description

tbProductCodes
Code (PK) | fkAccount | fkShape | Description

tbShapes
Shape (PK) | TableName | ShapeName

tbDoubleT
Template (PK) | fkCode | SectionName | Width | Height | Flange

tbRectangular
Template (PK) | fkCode | SectionName | Width | Height

tbCircular
Template (PK) | fkCode | SectionName | Radius

tbTSection
Template (PK) | fkCode | SectionName | X1 | Y1 | X2 | Y2



Any ideas?

Mike B

View 1 Replies View Related

SELECT Statement - How To Not Get Column Field Names?

Jan 24, 2007

I do a SELECT * from table command in an ASP page to build a text fileout on our server, but the export is not to allow a field name rows ofrecords. The first thing I get is a row with all the field names. Whydo these come in if they are not part of the table records? How do Ieliminate this from being produced? Here's the ASP code....<html><head><title>Package Tracking Results - Client Feed</title></head><body><%' define variablesdim oConn ' ADO Connectiondim oRSc ' ADO Recordset - Courier tabledim cSQLstr ' SQL string - Courier tabledim oRSn ' ADO Recordset - NAN tabledim nSQLstr ' SQL string - NAN tabledim objFSO ' FSO Connectiondim objTextFile ' Text File' set and define FSO connection and text file object locationSet objFSO = CreateObject("Scripting.FileSystemObject")'Set objTextFile =objFSO.CreateTextFile(Server.MapPath("textfile.txt"))'Response.Write (Server.MapPath("textfile.txt") & "<br />")Set objTextFile = objFSO.OpenTextFile("C: extfile.txt",2)' write text to text file'objTextFile.WriteLine "This text is in the file ""textfile.txt""!"' SQL strings for Courier and NAN tablescSQLstr = "SELECT * FROM Courier"' set and open ADO connection & oRSc recordsetsset oConn=Server.CreateObject("ADODB.connection")oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &"c:/Database/QaTracking/QaTracking.mdb" & ";"set oRSc=Server.CreateObject("ADODB.Recordset")oRSc.Open cSQLstr, oConnResponse.ContentType = "text/plain"Dim i, j, tmpIf Not oRSc.EOF ThenFor i = 1 To oRSc.Fields.CountobjTextFile.Write oRSc.Fields(i-1).NameIf i < oRSc.Fields.Count ThenobjTextFile.Write " "End IfNextobjTextFile.WriteLineWhile Not oRSc.EOFFor i = 1 To oRSc.Fields.CountIf oRSc.Fields(i-1) <"" Thentmp = oRSc.Fields(i-1)' If TypeName(tmp) = "String" Then' objTextFile.Write "" &_'Replace(oRSc.Fields(i-1),vbCrLf,"") & ""' ElseobjTextFile.Write oRSc.Fields(i-1)' End IfEnd IfIf i < oRSc.Fields.Count ThenobjTextFile.Write " "End IfNextobjTextFile.WriteLineoRSc.MoveNextWendEnd IfobjTextFile.CloseSet objTextFile = NothingSet objFSO = NothingoRSc.CloseSet oRSc = NothingoConn.CloseSet oConn = Nothing%></body></html>

View 1 Replies View Related

Howto Use The Query Results As View Column?

Sep 17, 2006

Hi All,I have two tables, one is about member infomations, the other is thecatergoriesmember_info(id,name,email,phone)member_categories(id,category)how can create a view like this (id, name, category1, category2,category3) with high performance?Thanks in advance.Joshua

View 2 Replies View Related

SQL DTS Source Without Column Headings

Mar 3, 2004

If the SOURCE doesn't have column headings in a txt file (the format will be pipe delimited), how can I make it work (Through DTS) to load the source into my designed SQL Table? Thanks in advance!

Jqiu

View 4 Replies View Related

Using Records As Column Headings

Sep 22, 2006

This may be a stupid question, but I have a table of orders that consists of various data. I want to take by date all orders that have been completed but have not had a previous order in 180 days. I have this part done. What gets returned is Date, Count, Status. What I want to get is the various status's returned as headings. So I get Data, Total Order Count, Completed Count, Abandoned Count, etc. I'm returning this data to Excel for display. My original thought was seperate queries, but some of the data will not have a count so the ordering would be off. Any ideas?

View 3 Replies View Related

Force IS To Use Column Headings

Feb 2, 2006

Hi,
I've got an IS package which reads a lot of records from a text file and loads that into the database. The text file has column such as Firstname, Lastname, phone number etc and same as the database table.

The problem:
IS works fine if I have the text file columns in the same order as the database columns but for example if have phone number in the place of firstname (in the text file) IS puts the phone numbers as firstname in the database and moves all the columns dow the order.

Is there anyway I could force IS to use the heading names in the text file and put it in the appropriate database columns?

Thanks guys...

View 4 Replies View Related

Scrolling Column Headings

Nov 30, 2007

Greetings,

I have generated a report that requires the user to scroll down the page since it is fairly long. I want to be able to show the column headings as the report is being scrolled. Much like excel locking the column headings as you would scroll down the spreadsheet so you know what values correspond to what heading. How do I configure this report to do this? Any suggestion is greatly appreciated. Thanks!

View 6 Replies View Related

Dynamically Changing Column Headings

Feb 5, 2008

We have a query in which we have data in fields called TS1Min, TS1Max, TS1Avg, TS2Min, TS2Max, TS2Avg etc.

We have a different table in which we define that vale of TS1, TS2, as an example TS1 might equal RED, TS2 might equal BLUE.

We have written a query that puts TS1Min, TS1Max, TS1Avg, TS2Min, TS2Max, TS2Avg in a temp table #TEMPA

and we also put the values of RED and BLUE in another temp table #TEMPB

now we want to select * from #TEMPA but rename the headings TS1Min to display RED-TS1Min, TS1Max as RED-TS1Max, TS1Avg as RED-TS1Avg etc...

any ideas on how to do this

View 4 Replies View Related

Looking For A Way To Turn Column Headings Into Rows

Apr 2, 2008

I am relatively new to SQL and have experience with relatively simple queries and data manipulation. I have just finished creating a fully normalized database, which, of course, is presenting me with a few problems retrieving data. I'm not sure if I'm even taking the right approach. Anyway, I am trying to create a web search with a filter. I want my filter to be based upon different columns in a view, rather than rows in one column. I have the following columns:


Emp_Title, Department_Name Company_Name Office_Location, Practice_Area_Name, Practice_Group_Name, School_Name, Emp_Zip_Code

I want to populate a drop list with these column headings. So I thought I would need a way to make a dummy column named Category or something, and then make each of these columns a row in the the Category colum. Can that be done?

Any help would be appreciated.

View 3 Replies View Related

Is There A Feature In RS2005 For Using Different Languages In Column Headings?

Nov 16, 2007

we'd like our users to have the option of choosing the language (eg French) for column headings (maybe report heading too). I'm sure I'd have to provide the translations somehow but I'd like to know what feature, if any in RS2005 comes the closest to doing/supporting this, even if it is something like making column headings themselves dependent on a variable?

View 5 Replies View Related

Isqlw - Suppressing Column Headings In Output Files

Jun 5, 2001

I'm using isqlw to generate delimited text files from scripts. There are several SET options available so that you can restrict the output to just the data in the script, for example SET NOCOUNT ON.

I can't find a similar SET option to suppress the column headings, although there is a tickbox that allows you to do this in Query Analyzer (Query -> Current Connection Options -> Advanced -> Print Headers)

DTS packages appear to support this, yet I can't find the setting from a dts file.

Thanks,

Paul

View 1 Replies View Related

Problem With MSAccess And Executing A DTS Package Via VBA - Returns Column Headings Only

Jan 31, 2007

I wonder if anyone can help with this. I have searched around and not found much on the topic which can resolve my problem.

History on the reason for using VBA and not C# or VB or VB.net etc. Whn I arrived at this company, there were no development tools so had to resort to Access and VBA. Of course, the routines I wrote are now set in production and I haven't had much time to convert them to c# and ASP.NET (which I have learnt over the past couple of years).

Anyway the problem is that I found on the SQLDTS.com site that I could in fact create and execute DTS packages within VB and followed the examples and got this working in VBA. Of course I created the DTS first and then saved it as VB, then used the resulting code with the VBA project etc etc. This worked well and we were happy.

The DTS packages I create and execute are to export data from SQL2000 tables to tabs in Excel spreadsheets.

Now I find that on my machine, when the objPkg.execute command runs, the Excel file is created but only the query column headings are populated into the excel file. No data is returned.

If I run this on a different machine it works (although having said that, the other machine is now starting to display similar behaviour on some routines).

we created a version of the Access 2000 MDB in Access 2003 some time ago and the Access 2000 still behaves correctly. The strange thing is that my machine has only started doing this incorrectly a little while ago (not sure how long now but could be as little as a couple of months). The routines are monthly processes so it's only going to show up as a problem once a month so the fact that it used to work on my machine and has only failed the last couple of times means that something must have changed on my setup. I am runningXP-Pro SP2 - fully patched, Office Pro 2003 and talking to SQL 2000 SP3a

is it possible that some windows updates or office updates are clobbering something which used to work?

If I allow the VBA to create the DTS but not execute it, I can execute the created DTS manually from SQLEM and it outputs data correctly.

No security access to the SQL databases/table has changed, nor have there been any changes to security on the file system where the files are written.

It's weird.

Any help would be gratefully accepted.

Annabel



I'm really lost and not sure whether I should look at driver versions, ODBC versions blah blah

View 1 Replies View Related

SSIS Database Table To Flat File Destination With Column Headings

Sep 8, 2006

Hi,

I have a simple enough task to complete that I can€™t seem to find the answer to.

The task is this €“

Select table x from the database and write it to a flat file complete with that tables column headings.

Now I€™ve managed to set up an ole db datasource and selected the table and I€™ve also linked it to the flat file output.  So now I can generate a flat file from the database.  However no column headings appear in the flat file. 

I can€™t seem to find anywhere (like a checkbox) that will also output the column headings to the flat file. 

Now I can add in Headings manually in the properties of the Flat File Destination object but the columns that appear in the flat file don€™t appear to be in the order that I requested them in the SQL.

So the question is how do I automatically have the column headings appear for flat file output (ideally without me having to manually add them in).

If it can€™t be done and I have to use a vb.net script instead then would anyone have an example script of how to do it?

Thanks in advance for anyone who manages to answer this.

Matt.

View 6 Replies View Related

Table Names And Field Names

Jan 21, 2004

I'm trying to do an update query that looks like this:

UPDATE

PAEMPLOYEE

SET PAEMPLOYEE.LOCAT_CODE = EMPLOYEE.PROCESS_LEVEL


FROM

PAEMPLOYEE A

JOIN EMPLOYEE B ON A.EMPLOYEE = B.EMPLOYEE

It's erroring out on the Employee prefix B.EMPLOYEE saying:

..."does not match with a table name or alias name used in the query"


Is it wrong or will it cause problems to have a field name the same as the table name?

View 5 Replies View Related

Determine Table Names And Column Names At Runtime?

Jan 22, 2004

Hi

I was wondering if anyone has an idea of how we could find the table names and column names of the tables in our Sql server database at runtime/dynamically given our connection string? Please let me know.

Thanks.

View 5 Replies View Related

Reporting Services :: Saving Report With Taller Column Headings To Excel Cuts Off Taller Headers

Nov 20, 2015

we are running 2014 enterprise. A couple of column headings (even with smaller font) are a little tall, as much as 6 "lines".   All headings in the respective matrices are aligned vertically as "bottom".  When I save the report to excel, these taller headings get chopped off visually in their excel cell.   The cell contains the entire heading.  It appears that the second "line" of the heading is the one that is most visible in excel. 

How do I get these to be saved so user will see entire heading when opening excel doc? In the first matrix there is a text box directly above the matrix and only one row of column headings.  In the second there is a higher column group heading containing month name above the problem headings. 

View 4 Replies View Related

Query Names Of Stored Procedure Results Columns?

Mar 2, 2012

I am imagining something you might pass the names of 2 stored procs (an old version and new one), and a query to produce valid parameters. It would then fire off each proc for a set number of executions, while storing off the results in temp tables, and at the end it would do a data compare, and store off performance data from dynamic management views.

Now I know how to get the parameters for a stored procedure out of the catalogue views, but is SQL Server aware at all of the schema of the results of stored procedures that return result sets, becuase I was thinking of doing something like...

INSERT INTO #datacompare(col1,col2)
EXEC mystoredprocedure

... but I can not seem to figure out how to dynamically gather the schema of the result set.

View 1 Replies View Related

User Can View All Database Names

Apr 17, 2008

I create a user then I create a database and assign my newly created user as owner

When I login as this new user everything works fine BUT my newly created user can still see other database names even though he is not allowed to use them.

How can I prevent him from seeing other database names.

P.S. I use the GUI

Thank you

View 2 Replies View Related

Cannot View Master.sysdatabase Names In Webpage

Jan 10, 2006

I have a webpage that should display the database names from the master.sysdatabases in a dropdownlist.
The code for the stored procedure works fine in Query Analyzer and returns the list of all database names under that instance of SQL-Server 2000.
The code:
   select name from master.dbo.sysdatabases   order by 1doesn't return the sysdatabase names to the ASP.NET webpage when executing the stored procedure. It returns:   System.Data.DataRowViewWhy does it do this and how can I fix it?Tx

View 5 Replies View Related

Stored Procedure Table Names To View

Sep 7, 2005

I need help to create a stored procedure to get the table names from a database and create a Union view. There are over 100 tables.

View 3 Replies View Related

Table Column Names = Dataset Column Values?!

Apr 28, 2008



I need to create the following table in reporting services



PRODUCT April March Feb

2008 2007 2008 2007 2008 2007
chair 8 9 7 4 4 4
table 3 4 5 6 4 6





My problem is the month names are a column in the dataset, but I dont know how to get it to fill as column headers???


Thanks in advance!!!

View 1 Replies View Related

Field Names From SQL Statement

Mar 9, 2004

Is there anyway to determine what the resulting Field Names are going to be from a SQL Statement?

For example:
SELECT TABLE1.FIELD1, TABLE1.FIELD2, TABLE1.FIELD3, TABLE2.FIELD1 AS ANOTHERNAME
FROM TABLE1 INNER JOIN TABLE2 ON TABLE1.PK = TABLE2.FK

resulting field names:
FIELD1
FIELD2
FIELD3
ANOTHERNAME

Seems easy enough splitting all values before "FROM" by comma and doing some manipulation to remove table names and anything before the word "AS". However, it gets more difficult when you have complex CASE statements embedded in you query that may also contain commas.

Just a shot in the dark because I don't know if anyone has already done something like this before.

Thank you in advance,

Jeff

View 2 Replies View Related

Return Field Names

Jun 1, 2005

Howdy all,I'm wishing to write a stored proc to return only the field names from a table.  What I've tried gets the field names but also returns all of the data in each row.  I only want the field names.  Is this possible?Thanks!JP

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved