Cross Tabs Problem In Sql Server
Apr 17, 2004
I want a query which is used in sql server like access query
TRANSFORM Sum(Q_DayBook.Debit) AS SumOfDebit
SELECT Q_DayBook.Purticular, Sum(Q_DayBook.Debit) AS [Total Of Debit]
FROM Q_DayBook
GROUP BY Q_DayBook.Purticular
PIVOT Q_DayBook.CDate;
View 1 Replies
ADVERTISEMENT
May 7, 2015
While looking forward to design a multi-columnar cross-tab query I am anxious to know if there could be a way to change the default names of the pivot columns? In other words for the query like the following can there be a way to apply anAS type command to reflect some other names, instead of having the four dates in heading? Something like Month_A, Month_B?
SELECT * FROM
(SELECT
X.REP_DT,
X.CUST_ID
AMOUNT_1
FROM
X) P
PIVOT (SUM(AMOUNT_1) FOR REP_DT IN ([2014-12-31], [2015-01-31], [2015-02-28], [2015-03-31])) PVT_01
View 3 Replies
View Related
Apr 21, 2015
Using below script to export the select statement result to .xls
declare @sql varchar(8000)
select @sql = 'bcp "select * from Databases..Table" queryout c:bcpTom.xls -c -t, -T -S' + @@servername
exec master..xp_cmdshell @sql
But result is not exporting in seperate tabs, all 4 column details are exporting in single cell.
how to export the data in columns to separate tabs in excel.
View 2 Replies
View Related
Oct 24, 2005
Hi All:
When I check out > 2000 customer databases cross 8 SQL 2000 servers, I wish I could use
"Select * from " + @server + "." + @databaseName + ".information_Schema.coulmns
where column_name = " + @column_name.
It did not works in this way.
However, why it works on
"Select * from serverA.master.information_schema.columns"?
It is also a cross server query but is on Master DB.
thanks
-D
View 3 Replies
View Related
Jan 31, 2008
Hi all,
My support team inform me that my servers have been updated and rebooted on monday. Now I need to run some cross db queries today and I dont seem to be able to connect anymore. I am getting the (dreaded apparant but not surprisingly) Msg 17, Level 16, State 1, Line 1
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
Now first thing I did was try to drop both linked servers and add again. I am thinking that the particular server has a dynamic ip which I have determined. Ive noticed a work around on MSFT but it say about using a connection string with IP.
Can anyone help me work this out? id appreciate it.
"Impossible is Nothing"
View 7 Replies
View Related
Oct 14, 2006
I have a table with results from several inspection tests. The Pass/Fail parameter in the cross-tab output would be Pass if all tests for that serial number are Pass, and Fail if any of the results for that serial number are Fail.
How would I create a cross-tab query in SQL Server?
Table for input to cross-tab query: [Inspection Data]
SerialNumber ParamName Result Pass/Fail
001 Test1 3.43 Pass
001 Test2 3.27 Pass
001 Test3 2.97 Pass
002 Test1 2.88 Pass
002 Test2 3.01 Pass
002 Test3 4.22 Fail
003 Test1 3.11 Pass
003 Test2 2.91 Pass
003 Test3 3.28 Pass
Cross-tab Query Output:
Test1 Test2 Test3 Pass/Fail
001 3.43 3.27 2.97 Pass
002 2.88 3.01 4.22 Fail
003 3.11 2.91 3.28 Pass
Thanks,
Sam
View 4 Replies
View Related
Oct 5, 2004
I am attempting to remember the string to dump/restore a database to a different physical server.
I have the database on Server 1 and want to back it up to server 2. Can anyone refresh my memory?
Thanks
View 3 Replies
View Related
Oct 5, 2004
I am attempting to remember the string to dump/restore a database to a different physical server.
I have the database on Server 1 and want to back it up to server 2. Can anyone refresh my memory?
Thanks
View 2 Replies
View Related
Feb 1, 1999
hi, here I create a cross tab query in access 97 this is the code
TRANSFORM Count([1].ORD_NBR) AS [The Value]
SELECT [1].SRMGR_NAME, Count([1].ORD_NBR) AS [Total Of ORD_NBR]
FROM 1
GROUP BY [1].SRMGR_NAME
PIVOT [1].ASR_SUPP;
I export this table to sqlerver 6.5 and run the same code. IT DIDNOT WORK
My question is how can I implement crosstab query in sql server 6.5?
any one can help I really do appreciate
Ali
View 2 Replies
View Related
May 2, 2006
Hi,
Recently the powers-that-be migrated the largest databases from one server to another, more powerful server while keeping some support data on the original server. My problem: I need to run queries on tables spanning both database servers. Unfortunately, I can't find any documentation on how to do this. Does anyone have any ideas?
Thanks!
View 1 Replies
View Related
Sep 11, 2006
The system has worked for two years.SQL Server 2000 runs on Windows 2000 Server "A".Another instance of SQL Server 2000 was moved from Windows 2000 Server"B" old to Windows 2003 Server "B" new, by restoring a backedup copy from old to new.The system has cross server updates, where Server "A" is updatingrecords in very large tables on Server "B".After the move from Server "B" old to Server "B" new, suddenlythe cross server updates fail, but only when they are conducted withina Begin and Commit Transaction batch.The system works when I remove the Begin and Commit Transaction, and nolonger have them run in a batch.Also, I had a cross server update, having "A" update records in"B", from a delete trigger residing on "A" table. Deletesagainst the "A" table fail so long as the trigger remains. Once Iremove the delete trigger from the "A" table, I can now deleterecords on the "A" table.Thanks. Dotnet Fellow
View 9 Replies
View Related
Nov 28, 2007
Hi, can someone please explain some more how to use cross-validation in SQL Server 2008 (CTP)? I read here that it "is under Accuracy Charts in Business Intelligence Development Studio, in addition to being accessible programmatically via a stored procedure call". What is the stored procedure and input parameters?
I'm actually interested in doing so inside an Integration Services package, in a data flow task.
Thanks,
Gustavo Frederico
View 8 Replies
View Related
Sep 11, 2006
The system has worked for two years.
SQL Server 2000 runs on Windows 2000 Server €œA€?.
Another instance of SQL Server 2000 was moved from Windows 2000 Server €œB€? old to Windows 2003 Server €œB€? new, by restoring a backed up copy from old to new.
The system has cross server updates, where Server €œA€? is updating records in very large tables on Server €œB€?.
After the move from Server €œB€? old to Server €œB€? new, suddenly the cross server updates fail, but only when they are conducted within a Begin and Commit Transaction batch.
The system works when I remove the Begin and Commit Transaction, and no longer have them run in a batch.
Also, I had a cross server update, having €œA€? update records in €œB€?, from a delete trigger residing on €œA€? table. Deletes against the €œA€? table fail so long as the trigger remains. Once I remove the delete trigger from the €œA€? table, I can now delete records on the €œA€? table.
Thanks. Dotnet Fellow
View 5 Replies
View Related
Jan 10, 2002
Hi,
how can I remove newline characters and tabs from a char field in sql.
We are directing the results from a query to an excel and having the newlines in one of the columns is messing up the whole output.
thanks
Zoey
View 1 Replies
View Related
Mar 17, 2004
Is there any way to remove tabs from text fields? I see tabs at the end when I import the data in Excel.
Appreciate any help
View 1 Replies
View Related
Apr 18, 2007
Using System Role Assignment I grant a domain user account "System Administrator" & "System User" within Reporting Services.
Then I connect via IE7 to Report Server with the domain account that has been granted the above rights. The page comes up but the "Contents" and "Properties" tabs are missing. This user can use "Site Settings" and perform admin though.
If I assign the users domain account to the local Administrator group on the Win 2003 Server, then when they reconnect to Reporting Services the missing tabs appear.
We are a development shop, need some of our qa testers and developers to have admin rights within Reporting Services but don't want to grant them local Administrator rights on the server. This could also be an issue upon deployment at customer sites.
So how to get round this. I have been trying ACL's on the Reporting Services directorys, ASP.Net security etc but with no success.
PS: Everything was sweet before SP2
View 1 Replies
View Related
Jul 10, 2006
I'm in Management Studio right now and I have two tabs called : "Table -dbo.contact".
As is the case, one tab is actually for the Schema of the table while the other shows the data in the table. (I'd also guess that if I was looking at a "contact" table from another database or server it would also be listed as "Table -dbo.contact").
Is there an option in Studio to provide more detailed tab descriptions?
TIA,
Barkingdog
View 4 Replies
View Related
May 4, 2007
Hi,
I want to rename the worksheet tabs when I export the report to excel. The answer is NO with SQL Server 2005 but any luck with SQL Server 2005 Service Pack 2? Please help.
View 3 Replies
View Related
May 22, 2002
I need to update serverB.databaseB.tableB.columnB value
based on serverA.databaseA.tableA.columnA value change,
the update trigger in serverA.tableA works fine in
updating a testing databaseB.tableB.columnB in the same serverA.
serverB is as the linked server in ServerA and DTC is on.
when change the trigger to point to serverB.databaseB....
error:--------------------------------------------
Server: Msg 7395, Level 16, State 2, Procedure trInsUpdDel_InboundCannedMessages, Line 169
Unable to start a nested transaction for OLE DB provider 'SQLOLEDB'.
A nested transaction was required because the XACT_ABORT option was set to OFF.
[OLE/DB provider returned message: Cannot start more transactions on this session.]
thanks for the help
David
View 2 Replies
View Related
Nov 6, 1998
I am trying to compare the data from 2 different servers. It is the same table. I did a select * and put the data into 2 different text files. I then used the Windows NT findstr utility to compare them to find the differences. I used the command findstr /v /i /x /g:file1 file2 > file3, where file1 is the larger table, and file2 is the smaller one. I want to find the records in file2 which are different or do not exist. I recieved no data back. I have ASCII characters in the text files. My question is does anyone know of a better way to do this, or how to make this command work?
View 1 Replies
View Related
Dec 13, 2007
Hi! I am using the Cross Validation tab in BIDS. Can you explain why my Liklihood Log Score is a negative number (according to BOL - meaning it is worse than a random guess) when my lift chart shoes that the alogorithm is significantly better than a random guess.
Also, the BOL definition for truenegative and falsenegative are hard for me to interpret. If I have a target state of "Yes", can you please put those definitions in yes/no terms for me?
Thanks.
Ann
View 3 Replies
View Related
Mar 28, 2007
Dear forum users,
I am a newbie in using MS SQL server with analysis services.
There seems to be no 'cross-validation' tool in MS SQL
which is frequently used in data mining and even statistics.
Is there anyone having similar difficulties?
Is there any solution like a small scripts to divide
the given dataset with multiple folds?
Your valuable comments and feedbacks would be appreciated.
Minnetongka
View 4 Replies
View Related
May 3, 2014
SQL query windows saves all the tabs in numerical sequence after you close each window. SO for example if you are typing query in window 1 and close it and open a new query windows it labels the new windows as SQL Query2 and so on.
What is the purpose of saving the SQLQuery windows like this? And how to retrieve all the windows.
View 9 Replies
View Related
Jan 12, 2008
I know this is an easy one. I have some how made the message and results tabs disapear. Now when i run somethinbg in the query window i don't see my results or errors.
Where do i click to bring those back?
View 1 Replies
View Related
May 8, 2008
I know from experience that the Excel connection mechanisms are somewhat limited. I was wondering if anyone has come across a solution to this problem.
We receive an excel file from a business line. Basically a list of account mods for a given month. Due to the tabular nature of Excel, sometimes the amount of mods exceeds the limits of one tab and has to roll over into a second tab. The names of the tabs reflect the file creation date, which often is the last day of the month, but not always. Here is a question related to this-
Is there a way to "query" a the list of tabs in an Excel file, so that I could store that record set in an SSIS variable, use it to loop through all the tabs? If no, can you think of a way to somehow get the value of the tab name or names so that I can use it to dynamically set the OpenRowset value of the Excel Data Source?
Thanks for your help, everyone!
--Jon
View 6 Replies
View Related
Mar 20, 2008
Hello All,
I am viewing the report in Reporting Manager. It has four tabs at the top viz. View, Properties History and Subscription. When I click any one of Properties, History or Subscription and click the View tab again, I loose my dataset that was there before I started clicking the tabs. It prompts for the parameters again.
Is that by design? I find this a nuisance to enter the parameter again and run the report just because I navigated to a different tabs.
Any suggestions to alter this behavior to make the data sticky in the report?
Thanks
Phewa
View 1 Replies
View Related
Jan 15, 2014
I was reading Kenneth Fisher's and Dwain Camps' articles on unpivoting using cross apply... And I can actually get them to work....
CREATE TABLE #TxCycle(
Cycle INT NOT NULL,
PatientID INT NOT NULL,
ALOPECIA TINYINT,
Causality1 TINYINT,
Relatedness1 TINYINT,
[Code] ....
The one thing I was wondering was this: how do I extract the symptom names from the field list without knowing them all beforehand? Dwain does this
-- DDL and sample data for UNPIVOT Example 2
CREATE TABLE #Suppliers
(ID INT, Product VARCHAR(500)
,Supplier1 VARCHAR(500), Supplier2 VARCHAR(500), Supplier3 VARCHAR(500)
,City1 VARCHAR(500), City2 VARCHAR(500), City3 VARCHAR(500))
Can this be adapted if you don't know all the column names beforehand? (Likely not). Back in the dark ages, when I was working on a database like this, it was in Access, and I could loop over the fields collection and evaluate each field name. (Yes, I know you're not supposed to store information in field names, but I inherited that mess!)
View 7 Replies
View Related
Jul 2, 2015
I have 2 databases on the same server
One has a function, the other has the tables and views
using dba
select dbo.function(t.column) as x from dbb.dbo.table as t
gives m an invalid object name of dbo.table
using dba
select top 1 * from dbb.dbo.table works fine.
also if i create the function on the same db it works.
View 4 Replies
View Related
Jul 3, 2015
I have created SSIS package to transfer table data(1500 rows tbl size=140 MB).
To transfer data across the network its taking around 1 hr.
I have tried by removing indexes and constraints on destination table.
How should I improve the speed as the table is very small.
View 0 Replies
View Related
Sep 9, 2015
I'm unable to reproduce the error. when they upgrade their OS and SQL EXPRESS to a more recent version the error disappears.
The error is: Incorrect syntax near '.'
the query in question resembles this:
Select column1, column2
from Table1 T
cross apply function(t.column4,t.column5) F
where column3 = 'XXXX'
I made sure that the compatibility level is greater than 90 this error is happening on SQL2005 SP2 as well as SQL2008 with SP2 (but not all clients are suffering from the same problem)
Can it be the .net framework? Although the machines had .net framework 3.52.
Can the OS be an issue? The OS' seem to be old, Windows Server 2008 SP2
I've tried to reproduce the error by setting up virtual machines with same OS and SQL but, again, can't reproduce.
View 9 Replies
View Related
Jun 20, 2013
SSMS 2012: when you open up many sql files in the IDE, it starts hiding some tabs and you have to click on the drop down at the right to navigate to the tab you want. Is there a way to make it display more than one row of tabs, so that tabs are not hidden and always displayed?
View 3 Replies
View Related
Feb 27, 2014
I liked the default appearance of SSMS in 2005 and 2008. 2012 is lousy by default.
My quesion is whether it can be made to approximate the way it behaved in 2008.
What I liked: Registered Servers and Object Explorer resided on nested vertical tabs on the left-hand side of the screen. Queries stacked up on the right-hand side of the screen.
I managed to get the Registered Servers and Object explorer to display with nested vertical tabs (tabs at the top, rather than the bottom - that's ok). But if there aren't any other vertical tabbed displays, then the tab on top fills the screen. There's no point to that. Both Registered Servers and Object explorer are narrow trees. The rest of the screen is white nothingness.
If a query is opened, it then fills the screen - empty. If I want that in a vertical tab I have to manually make it one (right click, choose New Vertical Tab Group).
s there a way to make the doggone thing behave?
The way I got the Registered Servers and Object explorer to behave this way was to right click on a tab and play with the vertical tabbing options.
View 2 Replies
View Related
Feb 18, 2007
Ever since I installed Internet Explorer 7 I have recieved an error message when closing the browser tabs. It doesn't matter if I am closing one or all of the open tabs. Here is the message I recieve,
"Access violation at address 02050200 in module iesdsg.dll Read of address 25202E67"
This message didn't occur until I installed IE7. When I uninstall IE7 the message does not show up. Any insight would be appreciated.
View 4 Replies
View Related