Click here to Skip to main content
14,331,308 members
   

Database

 
AnswerRe: SQL Remote Connections Pin
jschell23-Mar-19 6:01
memberjschell23-Mar-19 6:01 
QuestionHelp with simple database Pin
Member 1418292514-Mar-19 13:14
memberMember 1418292514-Mar-19 13:14 
AnswerRe: Help with simple database Pin
Richard MacCutchan14-Mar-19 23:06
protectorRichard MacCutchan14-Mar-19 23:06 
AnswerRe: Help with simple database Pin
Eddy Vluggen14-Mar-19 23:17
mveEddy Vluggen14-Mar-19 23:17 
AnswerRe: Help with simple database Pin
Mycroft Holmes15-Mar-19 12:49
memberMycroft Holmes15-Mar-19 12:49 
PraiseRe: Help with simple database Pin
Peter_in_278015-Mar-19 14:20
professionalPeter_in_278015-Mar-19 14:20 
GeneralRe: Help with simple database Pin
Mycroft Holmes15-Mar-19 14:57
memberMycroft Holmes15-Mar-19 14:57 
QuestionOracle database USER and SCHEMA [SOLVED] Pin
Valentinor11-Mar-19 9:16
memberValentinor11-Mar-19 9:16 
AnswerRe: Oracle database USER and SCHEMA Pin
CHill6012-Mar-19 22:45
protectorCHill6012-Mar-19 22:45 
GeneralRe: Oracle database USER and SCHEMA Pin
Valentinor13-Mar-19 1:30
memberValentinor13-Mar-19 1:30 
GeneralRe: Oracle database USER and SCHEMA Pin
CHill6013-Mar-19 2:23
protectorCHill6013-Mar-19 2:23 
GeneralRe: Oracle database USER and SCHEMA Pin
Valentinor13-Mar-19 3:04
memberValentinor13-Mar-19 3:04 
AnswerRe: Oracle database USER and SCHEMA Pin
Eddy Vluggen13-Mar-19 0:59
mveEddy Vluggen13-Mar-19 0:59 
QuestionDisplaying multiple rows into single row as columns based on id - Sql Server Pin
Member 111541886-Mar-19 20:18
memberMember 111541886-Mar-19 20:18 
SuggestionRe: Displaying multiple rows into single row as columns based on id - Sql Server Pin
CHill606-Mar-19 21:47
protectorCHill606-Mar-19 21:47 
AnswerRe: Displaying multiple rows into single row as columns based on id - Sql Server Pin
Victor Nijegorodov6-Mar-19 21:52
memberVictor Nijegorodov6-Mar-19 21:52 
GeneralRe: Displaying multiple rows into single row as columns based on id - Sql Server Pin
Member 111541886-Mar-19 23:24
memberMember 111541886-Mar-19 23:24 
AnswerRe: Displaying multiple rows into single row as columns based on id - Sql Server Pin
Richard Deeming6-Mar-19 22:08
mveRichard Deeming6-Mar-19 22:08 
GeneralRe: Displaying multiple rows into single row as columns based on id - Sql Server Pin
Member 111541886-Mar-19 23:21
memberMember 111541886-Mar-19 23:21 
GeneralRe: Displaying multiple rows into single row as columns based on id - Sql Server Pin
Mycroft Holmes7-Mar-19 10:50
memberMycroft Holmes7-Mar-19 10:50 
QuestionHelp me with caculate debit balace and incredit by SQL server 2012 Pin
Member 141737536-Mar-19 19:08
memberMember 141737536-Mar-19 19:08 
Rant[REPOST] Help me with caculate debit balace and incredit by SQL server 2012 Pin
Richard Deeming6-Mar-19 21:58
mveRichard Deeming6-Mar-19 21:58 
QuestionSQL Access: Calculate the total elimination of records not the same month and year ? Pin
Member 24584674-Mar-19 21:26
memberMember 24584674-Mar-19 21:26 
QuestionQuery Question Pin
milo-xml1-Mar-19 2:14
professionalmilo-xml1-Mar-19 2:14 
So I'm working on a vendor's database trying to search it. It's not normalized real well and the tables are kind of elephanted up as it was originally an MS Access database that they ported to MSSQL. I cannot modify the database but I can create views. In any case, what I currently have is a recursive string builder assembling a SQL statement that searches across multiple tables and views that I created to try to streamline things (one of my first SQL projects, it's not pretty). As you can imagine, it's sloooow. Can anyone point me towards a tutorial that would help me optimize this search?

Current query and code:
    string[] strSearch = TextBox1.Text.Split(' ');
    string strSelect = "SELECT INVY.ITEMNUM AS Item, " +
        "INVY.DESCRIPTION AS Description, STOCK.QTYONHAND AS Quantity, " +
        "INVY.UOM AS 'Issue By', STOCK.LOCATION AS Location, INVY.MODEL AS Model, " +
        "INVY.UD2 AS IDGroup " +
        "FROM INVY LEFT OUTER JOIN STOCK ON INVY.ITEMNUM = STOCK.ITEMNUM " +
        "LEFT OUTER JOIN vw_Koogle_ISSREC_Grouping ON INVY.ITEMNUM = vw_Koogle_ISSREC_Grouping.ITEMNUM " +
        "LEFT OUTER JOIN INVVEND ON INVY.ITEMNUM = INVVEND.ITEMNUM " +
        "WHERE ";

    foreach (string strParam in strSearch)
    {
        strSelect = strSelect + "AND ((INVY.DESCRIPTION LIKE '%" + strParam + "%') OR " +
        "(INVY.NOTES LIKE '%" + strParam + "%') OR " +
        "(INVY.MODEL LIKE '%" + strParam + "%') OR " +
        "(INVY.UD2 LIKE '%" + strParam + "%') OR " +
        "(INVY.UD1 LIKE '%" + strParam + "%') OR " +
        "(INVY.ITEMNUM LIKE '%" + strParam + "%') OR " +
        "(vw_RRD_Koogle_ISSREC_Grouping.EQNUM LIKE '%" + strParam + "%') OR " +
        "(vw_RRD_Koogle_ISSREC_Grouping.NUMCHARGEDTO LIKE '%" + strParam + "%') OR " +
        "(INVVEND.VENDORITEMNUM LIKE '%" + strParam + "%')) ";
    }
    strSelect = strSelect.Replace("WHERE AND", "WHERE") +
        "GROUP BY INVY.ITEMNUM, INVY.DESCRIPTION, STOCK.QTYONHAND, " +
        "INVY.UOM, STOCK.LOCATION, INVY.MODEL, INVY.UD2 " +
        "ORDER BY INVY.DESCRIPTION";
    sqlMP2Search.SelectCommand = strSelect;
}


modified 1-Mar-19 11:31am.

AnswerRe: Query Question Pin
Afzaal Ahmad Zeeshan1-Mar-19 3:19
mveAfzaal Ahmad Zeeshan1-Mar-19 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.