I am trying to concoct a query that will join rows on the basis of a
whitespace insensitive comparison. For instance if one row has the value
'a<space>b' and another has the value 'a<space><space>b' I want them to be
considered equal (but not the same as 'ab')
I am happy to do some T-SQL if that helps. Also I have a full-text index on
the column in question, but note that I am comparing rows against each
other, not to a fixed string.
This is for a one-off job, so if there is no obvious way to do it on the
database, I will just bcp out the data and knock up some perl or something
to do it. All other things being equal I would rather do it on the database
though.
I have a table with names and some of the first names have accents. e.g. Jose. Now Jose has a access over the "e" in the database. How can I perform an access insentitive query to the database so if I type "Jose" without the accent over the "e" would return "Jose" with the accent over the "e".
Hi. I'm trying to find out which "cases" have a new items added to our database. I have provided a sample layout.
ID ParentID Name CreateDate 358 2 SMITH, JOHN 3/3/2008 11:15:23 am 359 358 Invoice 3/5/2008 4:13:52 pm 360 358 Shipping 3/5/2008 5:11:09 pm 361 358 Receiving 3/6/2008 4:22:01 am
The main ID for this is 358. The invoice, shipping, and receiving items are child items. I would like to run a query that can report which cases have newly added items. This is hierarchical I guess and I'm quite lost. I hope this makes sense. Thanks for any help!
Hi,Have a database that contains various tables.I need to run a query on two tables.Table A contains a column called TitlesTable B contains a column called Uni_TitlesIn Table B's column it contains multiple titles as shown belowseparated by semi-colons in each row.Table B Uni-Title Column__________________________Row 1: Landlord and tenant; Leases; Rent reviewsRow 2: Acquisitions; Advisers; Appointment; Contract termTable A - Titles Column_________________________Table A's column contains a only one of the words in Table B's columni.e. Landlord and tenantI would like to obtain a count of how many times the same word orphrases appears in the column of Table B.ThanksSteve
hii,,i am using asp.net 2005 and sql server 2005.i have a web page in which i can enter details and it gets stored in a table in a database..in the table thrs a column called as sme_id,,what i want is when one inserts a new sme_id from the page,,it should check in the table so tht no duplicate sme_id wil b generated..,,this code is workin fine,,i just want to implement the above condition...here is the insert code which i have used along with sql datasource:::__________________________ <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:sme_trackerConnectionString %>" InsertCommand="INSERT INTO SME_Master(SME_Id, FirstName, LastName, Type_of_SME, Agency_id, Agency_Name, Email, Address, Phone, Mobile, Fax, TimeZone_Id, Experience, City, State, Status, Level_Of_Exam, Other_Comments, Certificate, Expertise) VALUES (@SME_Id, @FirstName, @LastName, @Type_of_SME, @Agency_id, @Agency_Name, @Email, @Address, @Phone, @Mobile, @Fax, @TimeZone_Id, @Experience, @City, @State, @Status, @Level_Of_Exam, @Other_Comments, @Certificate, @Expertise)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [SME_Master]"> _______hope u got my problem,,,,,reply asap....thnks in advance
I have a single table named PROCESS which contain following three fields
ProcessID ParentID, info
* Every process have a unique ProcessID and ave single parent process which is identified by ParentID.
* If a process does not have a Parent then its ParentID value is -1.
*Only single level of Parent-child hierarchy is maintained.
Can anyone please tell me the Query that uses Recursive JOINS to retrieve the ProcessID s based in following Conditions.
1. if the Parent's 'info' field contains given value then retrieve all the process under it. 2. Retrive all the process whose 'info' contains given value and excluding the Processes resulted from 1st conditiion
I've successfully created a Linked Server that connects a local DB Engine with another DB Engine through an ip over an extranet. I am able to run simple Select statement queries on the Local DB Engine and get results from the linked server. However when attempting to perform more complex queries that join tables from the linked server with tables from the local DB server, I get the following error message after several minutes of execution:
OLE DB provider "SQLNCLI11" for linked server "<ip of Linked Server>" returned message "Protocol error in TDS stream". OLE DB provider "SQLNCLI11" for linked server "<ip of Linked Server>" returned message "Communication link failure".
Msg -1, Level 16, State 1, Line 0
Session Provider: Physical connection is not usable [xFFFFFFFF].
OLE DB provider "SQLNCLI11" for linked server "<ip of Linked Server>" returned message "Communication link failure".
Msg -1, Level 16, State 1, Line 0
Session Provider: Physical connection is not usable [xFFFFFFFF].
OLE DB provider "SQLNCLI11" for linked server "<ip of Linked Server>" returned message "Communication link failure".
Msg 10054, Level 16, State 1, Line 0
TCP Provider: An existing connection was forcibly closed by the remote host.
How I can resolve it. I've read on Distributed Transactions but I understand that it only applies to manipulation statements?
Both are SQL servers. Linked Server is SQL2008R2 if not mistaken. Local DB Engine is SQL2014.
I am working in a SQL server database that is configured to be case-insensetive but I would like to override that for a specific query. How can I make my query case-sensitive with respect to comparison operations?
I am currently working on a rather simple report, it cosists of a table with two columns The first column contains Employee Names, and the second column contials details of what the have worked on I have made the second column invisible, and can be made visible when the eployee name column is expanded. The problem that i am having is that when the second column is collapesed, it still leaves whitespace, in the first column, of how ever many rows that are contained in the second column, is there a way, I can get rid of that whitespace?
I am having a problem with whitespace showing up within a table. I have a grouping by date that toggles the fields correctly but when the fields are not expanded, the space where the data would be is showing as whitespace instead of collapsing up. Can anyone shed some light on how to make the whitespace go away?
I am hoping there is an easy way to fix this. I have a report defined 8.5" x 11.0" with .5" Margin's all around. I am using the WinForms Report Viewer Control (doing Server side reports). It looks like the viewer is taking the left margin and adding it to the right margin. So you get large amounts of white space on the right of the viewer. This requires me to make the viewer way larger than it needs to be to get rid of the ugly Horizontal Scroll bar.
What I want is either don't show the margins until you print (removing the margins from the RDLC file does nothing), or have the left margin white space belong on the left side.
Why is this happening? And how can I fix it? Thanks!
I have a report that, among other things, contains 3 tables laid out side-by-side horizontally. The first table is conditionally visible and when it is hidden the report contains whitespace instead of the table. The problem is that this causes an unappealing visual look because the other 2 tables look shifted too much to the right.
What is the recommended way for dealing with situations like this? There doesn't seem to be support for specifying the location (i.e. top, left) of elements based on expressions. Am I "stuck" with having to create multiple flavors of the report?
I have a OLE DB Source going to a flat file destination. My source is a sql variable with "select * from tablename" which have varchar datatypes. Yet I'm getting trailing spaces at the end of some of my columns (for instance, my address column).
I've checked the data by doing a "select Max(Len(address)) from tablename" and the max is only like 34 chars, yet each of them have 100 chars total.
Taking a look at my flat file connection, the outputColumnWidth is 100, and datatype is string [DT_STR]. Am I crazy? What's the problem here? Is the DT_STR datatype the equivalent of char, and not varchar?
I'm trying to figure out how to find the last whitespace character in avarchar string. To complicate things, it's not just spaces that I'mlooking for, but certain ascii characters (otherwise, obviously, justuse LEN). My initial thought was to REVERSE it, find the location(using CHARINDEX) looking for each of those characters (so, multiplequeries), then subtract that from the LEN of the string.The problem I'm running into is that there are about a dozen differentcharacters we're looking for. Any suggestions? My thought was to(this sounds silly, so there's gotta be a better way) dump the resultsfrom each CHARINDEX into a table, then find the MAX of the table anduse that. But, like I said, it sounds silly. I don't think I can do a[^0-9A-Z] either, since there are non-Alphanumeric characters we'relooking for.Many thanks.
I have a column that I do not want any whitespace in whatsoever. I'mwondering how do enforce this a DDL level instead of in 40 millionseat-of-the-pants after-the-fact computer programs accessing thedatabase.Regards,Terrence
I am having an problem with using full-text search and phrases in ASP.NET 2.0 when populating a treeview.
I have a stored procedure that searches a full text index and brings back the results in a datareader. It fails when I try to search for more than one word with a space in between. I get the error SQLException was unhandled by usercode "Syntax error near 'up'' in the full-text search condition ''item up''." The stored proc is as follows: CREATE PROCEDURE [dbo].[SearchResults] @criteria as varchar(50)
AS BEGIN SELECT * FROM PMGNT_PROJECTS PRJCT INNER JOINCONTAINSTABLE(PMGNT_PROJECTS,*,@criteria) K ON PRJCT.PRJCT_REFNO = K.[KEY] END
The stored procedure works fine though query analyser it's only when I try to use it in ASP.NET and use more than one word that it fails e.g. "item up". Search for single words also works fine in ASP.NET Code is as follows: 1 if (SearchField.Text != "") 2 3 { 4 5 string searchString = ""; 6 7 searchString = "'" + SearchField.Text + "'"; 8 9 10 11 SqlConnection SqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString); 12 13 SqlCon.Open(); 14 15 SqlCommand SqlCmd = new SqlCommand("SearchResults", SqlCon); 16 17 18 SqlCmd.CommandType = CommandType.StoredProcedure; 19 20 SqlCmd.Parameters.Add("@criteria", SqlDbType.VarChar); 21 22 SqlCmd.Parameters["@criteria"].Value = searchString; 23 24 25 26 SqlDataReader Sdr = SqlCmd.ExecuteReader(); 27 28 SqlCmd.Dispose(); 29 30 string[,] ParentNode = new string[200, 2]; 31 32 int count = 0; 33 34 while (Sdr.Read()) 35 36 { 37 38 ParentNode[count, 0] = Sdr.GetValue(Sdr.GetOrdinal("PRJCT_REFNO")).ToString(); 39 40 ParentNode[count++, 1] = Sdr.GetValue(Sdr.GetOrdinal("PRJCT_CODE")).ToString(); 41 42 } 43 44 Sdr.Close(); 45 46 for (int loop = 0; loop < count; loop++) 47 48 { 49 50 TreeNode root = new TreeNode(); 51 52 root.Text = ParentNode[loop, 1]; 53 54 root.Value = ParentNode[loop, 0]; 55 56 root.SelectAction = TreeNodeSelectAction.Select; 57 58 SqlCommand Module_SqlCmd = new SqlCommand("SELECT * FROM PMGNT_MILESTONES MILST where MILST_PRJCT_REFNO =" + ParentNode[loop, 0], SqlCon); 59 60 SqlDataReader Module_Sdr = Module_SqlCmd.ExecuteReader(); 61 62 string[,] ChildNode = new string[200, 2]; 63 64 int countChild = 0; 65 66 67 68 while (Module_Sdr.Read()) 69 70 { 71 72 ChildNode[countChild, 0] = Module_Sdr.GetValue(Module_Sdr.GetOrdinal("MILST_REFNO")).ToString(); 73 74 ChildNode[countChild++, 1] = Module_Sdr.GetValue(Module_Sdr.GetOrdinal("MILST_TITLE")).ToString(); 75 76 } 77 78 Module_Sdr.Close(); 79 80 for (int cloop = 0; cloop < countChild; cloop++) 81 82 { 83 84 TreeNode child = new TreeNode(); 85 86 child.Text = ChildNode[cloop, 1]; 87 88 89 90 root.ChildNodes.Add(child); 91 92 } 93 94 95 96 // Add root node to TreeView 97 98 SearchResultTree.Nodes.Add(root); 99 100 } 101 102 SearchResultTree.CollapseAll(); 103 104 SqlCon.Close(); 105 106 107 } 108 109
I have a need to create a report that has a graph at the top and a table at the bottom. The graph at the top can optionally be made hidden because they cause problems when exported to Excel as images. However, when I set the Hidden property of the graph to true, positions of all items on the report remain absolute. Meaning of course that the table that is located half-way down the page remains half-way down the page and there is a lot of nothing on the first half where the graph used to be.
It would be desirable to have the ability to have the table move up when the graph is not visible, however it obviously doesn't do it automatically and also refuses me the ability to change the position with an expression.
I know that this almost never happens... but Im dealing with an AIX flatfile-database conversion that brings 80 tables into SQL. Im not allowed to touch this stuff or to massage how its brought over to SQL, as it deals with medical records... What I need to do though, is on creating my own table imports, for my "account" fields to match with the existing SQL conversion table "account" fields, I have to match requirements... Existing account numbers are a total of 6 charaters. Account numbers with less than six characters contain leading whitespace character equivalents to total the six character spaces for "account number" When I import records, I need to force the same requirement and have a min and max length of characters for "account number" = 6 characters and any account number less than 6 characters must also have the necessary whitespace character equivalent added to it. How would I do this? It needs to be automated, as this is a process that will run nightly and cannot have a human sitting on it every day, 7 days a week... I cannot accurately join unless I can meet this requirement and my hands are tied because I can't change the way the formatting is done on the imported tables =( Any help would be greatly appreciated... I'm quite stuck
After all the pain I've been going through with code pages and collation, I was asked how, when sql server does it's joins and predicate searches, how does it actual (internals now) know the an "A" = "a" in an insensitive search?
I am facing whitespace issue in my SSRS report. I have simple tablix report with 10 columns. I am trying to toggle column 5 to 8 using on column 4. The problem I am facing is the whitespace. Now column 5 to 8 are only visible when we expand column 4. When the report is rendered on the screen, there is a huge gap between column 4 and 9.
I have a table in MSSQL 2005 Express that stores user data. I would like to maintain the cases of user names, but I need to insure that they are not duplicated using different cases. Is there a way that I can create a constraint to enforce this?
We have an in-house set of databases created by a member of staff who left the organisation in circumstances that mean he will not respond to queries relating to his work here. The programs he produced whilst in our employ are compiled and we have no access to the code, or the tools that he used (don't ask).
The programs allow the user to limit views based on various fields, but not the most useful field, a "memo" type field containing a textual description of work requests.
I only have Delphi 7 to use for the program development and have been using ADO, but my problem is I need to perform a case-insensitive search of a varchar(max) column based on text entered by user, but have been unsuccessful using LIKE and UPPER (which it appears you cannot use with a varchar).
Can anyone provide suggestions for what I am sure is a rather mundane and easy task for all of you.
Please note that I have only the Delphi, and no direct access to the SQL management tools.
I tried to retreive an input column using GetVirtualInputColumnByName, to map it with output, it gave error. I found that it is because the value passed bstrName parameter was in different case. say for example in the column it is "ColNo1" where as in the GetVirtualInputColumnByName i used "Colno1".
Can anyone tell, Is there anyway to find the column in a case in-sensitive way?