I am in doubt if its possible to make a select statement which enables me to consolidate multiple lines in the same table.
I have a table with a lot of companies and figures for each company.
Some of the companies owns some of the other companies in the table and in reverse, some of the companies are owned by some of the companies in the table.
I have a lot of columns, but basically the most important columns are:
Company Name, Company Mother , Company Daughter.
Each company has also a revenue column.
What I want to do is to consolidate all figures for absolute mothers e.i. companies which are not owned by another company in the list.
I therefore need a select statement which says something like:
Get the revenue of companies not owned by another company (e.i. absolute mother). Add to this, the revenue of all its daughters. Add to this the revenue of all the daughters daughters etc. until there are no daughters left.
In other words - aggregate the revenue for all the companies in the group under the name of the ultimate parent company.
I can easily select and add the revenue for the first level of direct daughters, but I dont know how many more daughters the daughters has etc.
I have a report with several matrix objects. The data contained in each matrix is simple. One matrix has one column of labels and a column of data. The other has 3 columns of data. Both matrix's only show about 25 rows of data. A variable amount of data is displayed above the matrix's so that sometime the render across a page boundary. Whenever this happens the matrix doesn't render rows down to the bottom of the page. A considerable amount of empty space is left on the page, the completed matrix is displayed on the next page. I'm wondering how to get the matrix to render in this empty space.
This problem only occurs when I view the report on screen, in the Visual Studio "Preview" window, or from the Report Server web site. Tiff, pdf and printed output doesn't contain the extra space.
I've tried adding my matrix to a List and a Rectangle to see of this would fix the problem but it didn't help.
I've check the dimensions and margins or the page and I don't think I have any sizing problems, everything should fit on the page.
Hey, take a look at the below. I need to sum the real balance of a line with the credit with the line above, or, n + 1. I don't wanna to have to walk across the lines to do the sum. Any idea of how to do that in a easier and better way? I tried using T-SQL, but I couldn't figure out how to do a reference to the next line on the SQL without moving the cursor.
Date Reference Description Debit Credit Real Balance Bank Balance
I'm using SQL mail to send an email from a stored procedure which works fine. However I need a line break in the middle of this email which I am struggling to achieve. I've tried adding char(13)+char(10) to the middle of the email body string but this does not seem to do anything. Any ideas?
I am using SQL Server 2005 Reporting Services and all my reports preview with many more pages, as the preview will show Page 1 of 20, but if I print the report I get say 12 pages. The reports are always correct, but the preview show less data per page? Is there a way to get the preview to be what is going to print out?
This occurs in MS Visual Studio 2005 also as well as from the web. On a drill down report I get on some reports only 10 line when the print out will have 30 lines perpage
I am generating hundreds of lines of sql with a tool and wish to execute is in runtime. The sql consists of table creation, procedure creation, aswell as inserts and updates. When i try with SqlDataAdapter I get an error. Does anyone have a solution on what I can do?
hi im making a page where i want a single line at a time to be pulled from my MS Database, basically at the moment i have a list of questions, but the page is displaying all the questions from my database, i only want it to pull out 1 and then if the user clicks the true button then it goes to another page and displays another question?
I take some data from a textbox and then dump it in to SQL.. and then try to show it on the page but the new lines in code dont show in HTML.I grab the data via a <%#Eval(xxx>%>so doing a replace isnt really an option there...any other ideas?
Assuming I have a line, is there a function I can call to create a parallel line at a given distance away.i.e - with the below I would want to draw a parallel line to the one output.
We have a very long and complicated SQL script which we run to upgradea version of our software from old to new. It works great in QueryAnalyzer, but when run through osql it takes errors on lines that arevery long and (I think) stops reading after a certain amount ofcharacters. I've searched the net but haven't found anyone mentioningthis before. I have tried the -w 5000 parm to no avail.Any suggestions?
I used to be able to enter new lines into the result pane cell for text(and varchar) data in Enterprise Manager, but now that I am using SQL2005 Management Studio, this feature is gone.Is there any way to do this?Also, copying to/from excel chops off part of the text in a cell and isvery infuriating.Any help would be appreciated.Dan
Hi, The chart is set to simple line I can not get my SSRS chart to show just the dots, instead it is joining the points together and show the points joining together and therefor appear as lines.. even tried setting the chart to simple scatter but then nothing appears on graph. Any thoughts please?
i wanna create two line types on the same graph. I'm using the following queries.
Code Block select count(l.created) as LoanOriginationNumberPreApproved , convert(char( 11), l.Created) as PreApprovedDate from LoanApplication l where l.Status <> 'Cancelled' Group by l.Created
and
Code Block select count(l.SubmittedOn) as LoanOriginationNumber , convert(char( 11), l.SubmittedOn) as SubmittedDate from LoanApplication l where l.Status <> 'Cancelled' Group by l.SubmittedOn
I combined these queries. I add clumns of the second query to select statement of first code. also added group by l.submittedon to group by l,created as group by l.created, l.submiited on. This is the problem.(I mean grouping)
But then SSRS does not allow me to put preaaproveddate and submitteddate to drop category filed? Does anyone know how to do that?
"Document contains one or more extremely long lines of text. These lines will cause the editor to respond slowly when you open the file. Do you still want to open the file."
I click Yes and my project open normally. Someone know why this happen? My project is small, have one package with any imports excel files to Sql Server 2005.
I would like to know how to set the grouping lines or the detailed line to get the function like in Excel: group plan Example:
+ Group line GL1 Detailed Line 1 Detailed Line 2
When the grouping function is active, you see the Group line GL1 only. By clicking on the + icone, you will see all the detailed lines (like in Excel document).
I need to break a column Fullname into two columns called Firstname and Lastname. The Fullname column contains users fullname with a space between first and last name, for example (jonh smith). I want the first name to be in Firstname and last name in Lastname. Can any one help me on this? Thanks in advance.
I need to break a column Fullname into two columns called Firstname and Lastname. The Fullname column contains users fullname with a space between first and last name, for example (jonh smith). I want the first name to be in Firstname and last name in Lastname. Can any one help me on this? Thanks in advance.
I want to generate a breakup report using Transact-SQL. The report is to broken on three parameters and on each breakup I need to calculate the sum of another parameter.
Not long ago I accountered this situation: I had two databases on "MS SQL Server". In one of the databases there was a nomenclature with very large primary key. I had to transport that nomenclature and transform the wide PK into single identity column into the other database.
I decided to use a function for that transformation. BUT that function had to mark somewhere which combination of the PK columns is relative to which identity value. BUT functions CAN'T WRITE under MSSQL. So I took the challenge and mine all sources of information. The result was a function "Exec4Fun" that breaks the rule. I suppose that with this function it's possible to avoid the restriction for triggers, which prevents writing in the triggering table? (not tested yet)
If someone needs such tools, just write back your e-mail and I'll send some code.
Hi all, I am writing a database for a sport club. In order to be able to show reports for achievements I need to break apart the datetime format in SQL.
Example table with columns: 1)Date of competition ||| 2)Time achieved by competitor for 100m(in format mm:ss.fff, minutes:seconds.hundreds) | 01/01/2008||| 00:15.231 | | 01/02/2008||| 00:12.543 | | 01/03/2008||| 00:15.332 |
Then I need to show this in a graph with axis X Date and axis Y Time to show personal development for the whole year. I do not want to CONVERT to VARCHAR because it won’t be possible to compare in the graph.
Hello,In a Stored Proc, I am building a string variable. I am getting outputsfrom 4 different queries and would like the string to have line breaksto display each entry in a different line in a text area. How can I dothis?i.eresult = result1 + result2 + result3 + result4.What characters can I enter so that the output is displayed in thetextarea asresult1result2result3result4Thanks,
HiI am trying to figure out how to exit a cursor loop if a specifiedcondition occurs.I have a select count(*) on a table like thisselect lagplats, count(*) from arsi where artnr = '1440'if that count(*) is > 1 I want to break that cursor loop and fetch thenext row into the cursor and continue.however if that count(*) > 5 I need to exit the entire procedure andnot try and fetch the next row into the cursorI find this hard to explain and the code is long and complicated so Ihope it is possible to understand what I am afterrgdsMatt
I have a table that I want to show only 3 times in every page. If the dataset return to me 7 results i want to show The first 3 in page 1, the second 3 in page 2, the last in page 3... only 3 in every page.
I created that function:
Function saltoCada(ByVal n As Integer)
If (iCount < n) Then
iCount = iCount + 1
Else
iCount = 1
End If
Return iCount
End Function
I created a group in a table with that expression: =Code.saltoCada(3) and then add a page break at end in the group.
Is that the way to do this?It doesn't work.. Any ideas?
I have a multiline textbox where users enter comments, then the comments are put into a SQL table, then a datagrid retrieves the comments from the table and displays them. The problem is when a user has blank lines between paragraphs, the datagrid simply puts the paragraphs together. I know I can use the <br> command to display the text properly in the grid, but how do I get the <br> command to store in the SQL table where the paragraph breaks would be. The paragraph breaks go into the SQL table as nothing more than several spaces. How do I get this to work?