Adding New Lines Into Results In The
May 15, 2006
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 SQL
2005 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 is
very infuriating.
Any help would be appreciated.
Dan
View 2 Replies
ADVERTISEMENT
Apr 24, 2015
I've successfully created a column bar graph that shows the availability (0-100%) for a given site for each month YTD. I would like to have fixed lines added to the graph across all the columns at the 99.0 and 99.99% marks to show where we've reached and surpassed these key service levels.
I can't seem to find any examples on how to do this. The line drawing tool doesn't always line up with the graph correctly when it's displayed so I was looking for a data point at those levels.
View 3 Replies
View Related
Jun 21, 2007
Hi,
I have to queries that return tables with the same names. How do i add these 2 so it returns one table?
Thanks for your help.
Mike
View 7 Replies
View Related
Jan 13, 2004
hello everybody,
I have a small problem and was hipeing someone could help. Want to run a query, where I sellect results from two tables. Once this is done I want to takes those results and update a table that is already created with those results. How would I do this? Thw eonly way I know how to do this is by writing this:
select CompanyName, ContactName, Address, City, Region, ProductName, UnitPrice INTO TABLE2
From Suppliers, Products
But the problem with this is that I can only input the query results into a new table that I would name above. I can't insert it into a table that has already been created.
This is the erroe that I receive:
There is already an object named 'TABLE2' in the database.
Please Help!
thanks
View 8 Replies
View Related
Apr 14, 2014
I have a table called approval_levels in which I have 2 columns:
|LEVEL_ID |NAME |
|1 |app_level_1 |
|2 |app_level_2 |
|3 |app_level_3 |
I have a second table called requests, in which I have 3 columns:
|REQUEST_ID |PRODUCT_NAME |MANUFACTURER |
|1 |wd-40 |Acme |
|2 |Windex |Acme |
|3 |Propane |Acme |
I have a third table which links the two called request_approvals which has 2 columns: REQUEST_ID, LEVEL_ID. When a request is approved for a specific level, I insert a value into this table. So, for example, lets say request 1 has been approved for all 3 levels, request 2 has been approved for only level 1, and request 3 has been approved for level 3, the table would show something like this.
|REQUEST_ID |LEVEL_ID |
|1 |1 |
|1 |2 |
|1 |3 |
|2 |1 |
|3 |3 |
Ok, so here the challenge: I need to show in a report all the requests, create a columns for each level and show whether or not that request is approved for that level. The end result has to be something like this:
|REQUEST_ID |PRODUCT_NAME |MANUFACTURER |app_level_1 |app_level_2 |app_level_3 |
|1 |wd-40 |Acme |X |X |X |
|2 |Windex |Acme |X | | |
|3 |Propane |Acme | | |X |
Keep in mind that if another value is added to the approval_levels table (ie app_level_4), I need to add another column to the table call app_level_4 dynamically.Now, how in the world do I do something like this?
View 1 Replies
View Related
Jan 28, 2014
These separate COUNT queries are very fast:
SELECT COUNT(id) as viewcount from location_views WHERE createdate>DATEADD(dd,-30,getdate()) AND objectid=357
SELECT COUNT(id)*2 as clickcount FROM extlinks WHERE createdate>DATEADD(dd,-30,getdate()) AND objectid=357
But I want to add the COUNT statements, so this is what I did:
select COUNT(vws.id)+COUNT(lnks.id)*2 AS totalcount
FROM location_views vws,extlinks lnks
WHERE (vws.createdate>DATEADD(dd,-30,getdate()) AND vws.objectid=357)
OR
(lnks.createdate>DATEADD(dd,-30,getdate()) AND lnks.objectid=357)
Turns out the query becomes immensely slow. There must be something I'm doing wrong here which results in such bad performance, but what is it?
View 7 Replies
View Related
May 6, 2015
I am getting inconsistent results when BULK INSERTING data from a tab-delimited text file. As part of my testing, I run the same code on the same file again and again, and I get different results every time! I get this on SQL 2005 and SQL 2012 R2.
We have an application that imports data from a spreadsheet. The sheet contains section headers with account numbers and detail rows with transactions by date:
AAAA.1234 /* (account number)*/
1/1/2015 $150 First Transaction
1/3/2015 $24.233 Second Transaction
BBBB.5678
1/1/2015 $350 Third Transaction
1/3/2015 $24.233 Fourth Transaction
My Import program saves this spreadsheet at tab-delimited text, then I use BULK INSERT to bring the data into a generic table full of varchar(255) fields. There are about 90,000 rows in each day's data; after the BULK INSERT about half of them are removed for various reasons.
Next I add a RowID column to the table with the IDENTITY (1,1) property. This gives my raw data unique row numbers.
I then run a routine that converts and copies those records into another holding table that's a copy of the final destination table. That routine parses though the data, assigning the account number in the section header to each detail row. It ends up looking like this:
AAAA.1234 1/1/2015 $150 First Purchase
AAAA.1234 1/3/2015 $24.233 Second Purchase
BBBB.5678 1/1/2015 $350 Third Purchase
BBBB.5678 1/3/2015 $24.233 Fourth Purchase
My technique: I use a cursor to get the starting RowID for each Account Number: I then use the upper and lower RowIDs to do an INSERT into the final table. The query looks like this:
SELECT RowID, SUBSTRING(RowHeader, 6,4) + '.UBC1' AS AccountNumber
FROM GenericTable
WHERE RowHeader LIKE '____.____%'
Results look like this:
But every time I run the routine, I get different numbers!
Needless to say, my results are not accurate. I get inconsistent results EVERY TIME. Here is my code, with table, field and account names changed for business confidentiality.
TRUNCATE TABLE GenericImportTable;
ALTER TABLE GenericImportTable DROP COLUMN RowID;
BULK INSERT GenericImportTable FROM 'SERVERGeneralAppnameDataFile.2015.05.04.tab.txt'
WITH (FIELDTERMINATOR = ' ', ROWTERMINATOR = '', FIRSTROW = 6)
ALTER TABLE GenericImportTable ADD RowID int IDENTITY(1,1) NOT NULL
SELECT RowID, SUBSTRING(RowHeader, 6,4) + '.UBC1' AS AccountNumber
FROM GenericImportTable
WHERE RowHeader LIKE '____.____%'
View 3 Replies
View Related
Jul 30, 2015
For each customer, I want to add all of their telephone numbers to a different column. That is, multiple columns (depending on the number of telephone numbers) for each customer/row. How can I achieve that?
I want my output to be
CUSTOMER ID, FIRST NAME, LAST NAME, TEL1, TEL2, TEL3, ... etc
Each 'Tel' will relate to a one or more records in the PHONES table that is linked back to the customer.
I want to do it using SELECT. Is it possible?
View 13 Replies
View Related
Sep 3, 2015
Is there any way or option to get the all columns of dataset added to table when we add a table in data region. It will take lot of time to add one by one and also there are chances to add one column ore than once.
View 7 Replies
View Related
Apr 1, 2007
hi, like, if i need to do delete some items with the id = 10000 then also need to update on the remaining items on the with the same idthen i will need to go through all the records to fetch the items with the same id right? so, is there something that i can use to hold those records so that i can do the delete and update just on those records and don't need to query twice? or is there a way to do that in one go ?thanks in advance!
View 1 Replies
View Related
Mar 25, 2015
I have four tables: Customer (CustomerId INT, CountyId INT), County (CountyId INT), Search(SearchId INT), and SearchCriteria (SearchCriteriaId INT, SearchId INT, CountyId INT, [others not related to this]).
I want to search Customer based off of the Search record, which could have multiple SearchCriteria records. However, if there aren't any SearchCriteria records with CountyId populated for a given Search, I want it to assume to get all Customer records, regardless of CountyId.
Right now, I'm doing it this way.
DECLARE @SearchId INT = 100
SELECT * FROM Customer WHERE
CountyId IN
(
SELECT CASE WHEN EXISTS(SELECT CountyId FROM SearchCriteria WHERE SearchId = @SearchId)
THEN SearchCriteria.CountyId
[Code] .....
This works; it just seems cludgy. Is there a more elegant way to do this?
View 4 Replies
View Related
May 24, 2006
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
Grp
Action
$0.00
$6,000.00
$86,814.27
*
$0.00
$4,000.00
$90,814.27
$0.00
$666.00
$91,480.27
*
Thank you!
View 2 Replies
View Related
Feb 12, 2008
Hello. I currently have a website that has a table on one webpage. When a record is clicked, the primary key of that record is transfered in the query string to another page and fed into an sql statement. In this case its selecting a project on the first page, and displaying all the scripts for that project on another page. I also have an additional dropdownlist on the second page that i use to filter the scripts by an attribute called 'testdomain'. At present this works to an extent. When i click a project, i am navigated to the scripts page which is empty except for the dropdownlist. i then select a 'testdomain' from the dropdownlist and the page populates with scripts (formview) for the particular test domain. what i would like is for all the scripts to be displayed using the formview in the first instance when the user arrives at the second page. from there, they can then filter the scripts using the dropdownlist.
My current SQL statement is as follows.
SelectCommand="SELECT * FROM [TestScript] WHERE (([ProjectID] = @ProjectID) AND ([TestDomain] = @TestDomain))"
So what is happening is when testdomain = a null value, it does not select any scripts. Is there a way i can achieve the behaivour of the page as i outlined above? Any help would be appreciated.
Thanks,
James.
View 1 Replies
View Related
May 14, 2008
Hi All,
I have a stored proc which is executing successfully...but the results of that stored proc are displaying in the Messages Tab instaed of results Tab. And in the Results Tab the results shows as 0..So, Any clue friends..it is very urgent..I am trying to call this stored proc in my Report in SSRS as well but the stored proc is not displaying there also...Please help me ASAP..
Thanks
dotnetdev1
View 4 Replies
View Related
Mar 7, 2008
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?
View 2 Replies
View Related
Jan 14, 2008
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
View 12 Replies
View Related
Jun 18, 2008
Hi all, I have the following SQLDataSource statement which connects to my Gridview:<asp:SqlDataSource ID="SqlDataSourceStandings" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT P.firstName, P.lastName, T.teamName, IsNull(P.gamesPlayed, 0) as gamesPlayed, IsNull(P.plateAppearances,0) as plateAppearances, IsNull( (P.plateAppearances - (P.sacrifices + P.walks)) ,0) as atbats, IsNull(P.hits,0) as hits, P.hits/(CONVERT(Decimal(5,2), IsNull(NullIF(P.atbats, 0), 1))) AS [average], (P.hits + P.walks)/(CONVERT(Decimal(5,2), IsNull(NullIF( (P.atbats + P.sacrifices + P.walks) , 0), 1))) AS [OBP], (P.hits - (P.doubles + P.triples + P.homeRuns) + (2 * P.doubles) + (3 * P.triples) + (4 * P.homeRuns)) / (CONVERT(Decimal(5,2), IsNull(NullIF(P.atbats, 0), 1))) AS [SLG], P.singles, P.doubles, P.triples, P.homeRuns, P.walks, P.sacrifices, P.runs, P.rbis FROM Players P INNER JOIN Teams T ON P.team = T.teamID ORDER BY P.firstName, P.lastName"></asp:SqlDataSource>There are 8 teams in the database, and somehow the average and obp results are as expected for all teams except where T.teamID = 1. This doesn't make sense to me at all! For example, I get the following results with this same query: First NameLast NameTeamGPPAABHAVGOBPSLG1B2B3BHRBBSACRRBI
BrianAustinHope83432230.7187500.7352941.15625014612201221
GabrielHelbigSafe Haven62119141.0000000.9375002.1428576404111519
MarkusJavorSafe Haven82927200.8695650.8000001.21739114501021218
RobBennettMelville83029240.8275860.8333331.55172411904102117
AdamBiesenthalSafe Haven82929210.9130430.9130431.56521712631001015
ErikGalvezMelville82625180.7200000.7307691.24000011322101015 As you can see, all teams except for Safe Haven's have the correct AVG and OBP. Since AVG is simply H/AB, it doesn't make sense for Gabriel Helbig's results to be 1.00000. Can anyone shed ANY light on this please?Thank you in advance,Markuu ***As a side note, could anyone also let me know how I could format the output so that AVG and OBP are only 3 decimal places? (ex: 0.719 for the 1st result)***
View 2 Replies
View Related
Jul 16, 2007
I have long SQL statement String sqlQuery = "INSERT INTO Objekt VALUES(@RegijaID, @StatusID, @VrstaID, @PozicijaID, @Adresa, @Otok, @Ime, @Prezime, @JMBG, @Telefon, @Telefon2, @Mobitel, @Mobitel2, @email, @Cijena, @Cijenam2, @BrojNaloga, @Agent, @BrojSoba, @BrojKatova, @BrojKupaonica, @NaKatuBr, @PovrsinaStambena, @PovrsinaZemljista, @UdaljOdMora, @PrviRed, @PogledNaMore, @Bazen, @Garaza, @Prilozi1, @Prilozi2, @Prilozi3, @Napomena, @smallImage, @KratkiOpisEN, @DugiOpisEN, @KratkiOpisHR, @DugiOpisHR, @PonudaTjednaCroestate, @PonudaTjednaNaslovCroestate, @PonudaTjednaBroker, @PonudaTjednaNaslovBroker, @PonudaTjednaKorcula, @PonudaTjednaNaslovKorcula, @PonudaTjednaCroProperty, @PonudaTjednaNaslovCroProperty, @PonudaTjednaDalmVillas, @PonudaTjednaNaslovDalmVillas, @LinkZaViseoMjestu, @DisplayOnWWW, @TS)"; How broken it into more lines?
View 6 Replies
View Related
Jan 27, 2008
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?
View 2 Replies
View Related
Apr 26, 2004
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?
Any ideas
Regards,
Joe
View 1 Replies
View Related
Jun 16, 2005
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?
View 1 Replies
View Related
Oct 3, 2005
I have a specific format that I need to export data to. The first three lines of the document MUST be in the form of:
ascii
,
klg, Eastern Daylight Time,1,1
PineGrove,0,2005/10/01,00:00,1,1.75,192
PineGrove,0,2005/10/01,00:05,1,1.75,192
Pinegrove,0,2005/10/01,00:10,1,1.75,192
If I set this up in DTS and do an export, it puts commas after ascii - which I cannot have.
I've also tried using two data sources and exporting twice (hoping to append), however, one just overwrites the other.
Anyone have any ideas?? :o
Thanks in advance,
Krista
View 6 Replies
View Related
Mar 19, 2014
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.
DECLARE @line geometry = 'LINESTRING(1 1, 2 2, 3 3, 4 4)'
SELECT @line
View 9 Replies
View Related
Nov 29, 2007
Hi all we are student of university
and we trying to make application
We are programming in Tsql.we must make a list of backup sets and backup jobs.
Every backupjob can have more then one backupsets. The problem is when we want to put this in table then. We see the costumors name double in it .
For excample
Mr Jurgen has more backupjobs
We see then in our table then
Loginname Wich Status
MRJURGen SET 1 GOOD
Mrjurgen Set 2 Good
Mrjurgen Set 3 NOT ok
What we want that comes like this in a table
Loginname Wich Status
MrJurgen Set 1 Good
Set 2 Good
Set 3 Not ok
But we keep getting MRjurgen in also in the other lines !
The solution that we think that could help is an while loop
But sadly it doesnt work
So we desperate asking here how to do this :(
Thanks
Students
View 5 Replies
View Related
Mar 4, 2008
I am trying to get an average result from similar records in a view:
Order No: Product: Price:
1 1 5
1 2 3
1 3 7
2 1 5
2 2 3
2 3 7
2 4 2
I need the sql statment to get the average price of order 1 and order 2 seperatly. Giving a result like:
Order No: Av Price:
1 x
2 y
Thanks in advance for you help
View 4 Replies
View Related
Feb 23, 2006
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?
View 4 Replies
View Related
Nov 28, 2007
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?
View 1 Replies
View Related
Jan 7, 2008
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?
View 2 Replies
View Related
Sep 22, 2006
Hi,
When i open a project in ssis show the message:
"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.
Thanks
André Rentes
View 1 Replies
View Related
Jan 24, 2007
Are trend lines supported in RS2005, and if so how do you produce them?
Thanks,
Peter Cwik
Trizetto
View 11 Replies
View Related
Apr 23, 2008
Hello,
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).
Thank you in advance for your replies.
regards,
View 4 Replies
View Related
Oct 19, 2007
Hi,
I have a web form that lets users search for people in my database they wish to contact. The database returns a paged set of results using a CTE, Top X, and Row_number().
I would like to give my users to option of removing individual people from this list but cannot find a way to do this.
I have tried creating a session variable with a comma delimited list of ID's that I pass to my sproc and use in a NOT IN() statement. But I keep getting a "Input string was not in a correct format." Error Message.
Is there any way to do this? I am still new to stored procedures so any advice would be helpful.
Thanks
View 3 Replies
View Related
Jan 30, 2008
Hi, when I copy and paste results from query analyzer into Excel it appears that values with zeroes at the end loose the zeroes. Example, if I copy and paste V128.0 into an Excel cell it comes out as V128 or if I copy 178.70 it displays as 178.7 - any ideas? I'm using SQL Enterprise Manager for 2000.
View 6 Replies
View Related