Search Results

Search found 1839 results on 74 pages for 'comma separated'.

Page 6/74 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • SQL use comma-separated values with IN clause

    - by user342944
    I am developing an ASP.NET application and passing a string value like "1,2,3,4" into a procedure to select those values which are IN (1,2,3,4) but its saying "Conversion failed when converting the varchar value '1,2,3,4' to data type int." Here is the aspx code: private void fillRoles() { /*Read in User Profile Data from database */ Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("sp_getUserRoles"); db.AddInParameter(cmd, "@pGroupIDs", System.Data.DbType.String); db.SetParameterValue(cmd, "@pGroupIDs", "1,2,3,4"); IDataReader reader = db.ExecuteReader(cmd); DropDownListRole.DataTextField = "Group"; DropDownListRole.DataValueField = "ID"; while (reader.Read()) { DropDownListRole.Items.Add((new ListItem(reader[1].ToString(), reader[0].ToString()))); } reader.Close(); } Here is my procedure: CREATE Procedure [dbo].[sp_getUserRoles](@pGroupIDs varchar(50)) AS BEGIN SELECT * FROM CheckList_Groups Where id in (@pGroupIDs) END

    Read the article

  • How to check data in a column separated by a colon (:)

    - by tonsils
    Hi, I have an Oracle database column, say col1, that has the following values: Col1 (A:B:C) I now need to come along and add to this Col1, only if it doesn’t exist, additional values but unsure how to go about checking to see if Col1 already contains these values. Scenario might be as follows: 1) Need to add B => Outcome=> check Col1 – B exists, do not add. 2) Need to add A:C => Outcome=> check Col1 – A and C exists, do not add. 3) Need to add C:D => Outcome=> check Col1 – C exists but D doesn’t, do not add C but need to add D 4) Need to add G => Outcome=> check Col1 – G doesn’t, need to add G Using Oracle sql or pl/sql I am unsure how to go about processing the above to ensure whether items exist or don’t exist and whether to add or not to add to Col1 Hoping someone can assist with a means of checking the data based on the above. Thanks

    Read the article

  • Retrieve rows where a value exists within a comma separated list

    - by Klaaz
    I like to reverse this query: SELECT * FROM table WHERE status IN ( option,option1,option2 ); in a query like SELECT * FROM table WHERE status contains ( 'option' ); Where field 'status' column contains (by example): 'option,option1'. When I use SELECT * FROM table WHERE status LIKE '%option%' ); It also selects the rows with a 'status' column that only contains 'option1' Is this possible? example data: id,name,status 1,'test1','option,option1' 2,'test2','option,option2' 3,'test3','option2' 4,'test4','option2,option3' 5,'test5','option' SELECT * FROM table WHERE status contains ( 'option' ); This query should select select record 1,2 and 5. 'status' field type is varchar. The problem is that the status fields contains data that is almost alike, exept from the added number to option. Off course this is a made up example but the real thing has this kind of parameters

    Read the article

  • Finding comma separated values with a colon delimiter

    - by iconMatrix
    I am setting values in my database for tourneyID,Selected,Paid,Entered,date then separating each selection with a colon So I have a string that may look like this 187,S,,,09-21-2013:141,S,,,06-21-2013:144,S,,,05-24-2013 but it also could look like this 145,S,,,07-12-2013:142,S,,,05-24-2013:187,S,,,09-21-2013 and some times is looks like this 87,S,,,07-11-2013:125,S,,,06-14-2013 I am trying to find this sequence: 187,S,,,09-21-2013 I have data stored like that because I paid a programmer to code it for me. Now, as I learn, I see it was not the best solution, but it is what I have till I learn more and it is working. My problem is when using LIKE it returns both the 187 and 87 values $getTeams = mysql_query("SELECT * FROM teams WHERE (team_tourney_vector LIKE '%$tid,S,P,,$tourney_start_date%' OR team_tourney_vector LIKE '%$tid,S,,,$tourney_start_date%') AND division='$division'"); I tried this using FIND_IN_SET() but it would only return the the team id for this string 187,S,,,09-21-2013:141,S,,,06-21-2013:144,S,,,05-24-2013 and does not find the team id for this string 145,S,,,07-12-2013:142,S,,,05-24-2013:187,S,,,09-21-2013 SELECT * FROM teams WHERE FIND_IN_SET('187',team_tourney_vector) AND (team_tourney_vector LIKE '%S,,,09-21-2013%') Any thoughts on how to achieve this?

    Read the article

  • How to match a variable list of items separated by commas

    - by user261915
    I want to turn something like this CS 240, CS 246, ECE 222, ... (more or less); Software Engineering students only into ('CS 240', 'CS 246', 'ECE 222', 'ECE 220') in Python, code that matches a single course looks like >>> re.search('([A-Z]{2,5} \d{3})', 'SE 112').groups() ('SE 112',) I prefer a regular expression only method because I have a bunch of other alternate reg exps using '|' to combine them. However, a method with split is acceptable.

    Read the article

  • Query to bring count from comma seperated Value

    - by Mugil
    I have Two Tables One for Storing Products and Other for Storing Orders List. CREATE TABLE ProductsList(ProductId INT NOT NULL PRIMARY KEY, ProductName VARCHAR(50)) INSERT INTO ProductsList(ProductId, ProductName) VALUES(1,'Product A'), (2,'Product B'), (3,'Product C'), (4,'Product D'), (5,'Product E'), (6,'Product F'), (7,'Product G'), (8,'Product H'), (9,'Product I'), (10,'Product J'); CREATE TABLE OrderList(OrderId INT NOT NULL PRIMARY KEY AUTO_INCREMENT, EmailId VARCHAR(50), CSVProductIds VARCHAR(50)) SELECT * FROM OrderList INSERT INTO OrderList(EmailId, CSVProductIds) VALUES('[email protected]', '2,4,1,5,7'), ('[email protected]', '5,7,4'), ('[email protected]', '2'), ('[email protected]', '8,9'), ('[email protected]', '4,5,9'), ('[email protected]', '1,2,3'), ('[email protected]', '9,10'), ('[email protected]', '1,5'); Output ItemName NoOfOrders Product A 4 Product B 3 Product C 1 Product D 3 Product E 4 Product F 0 Product G 2 Product H 1 Product I 2 Product J 1 The Order List Stores the ItemsId as Comma separated value for every customer who places order.Like this i am having more than 40k Records in my dB table Now I am assigned with a task of creating report in which I should display Items and No of People ordered Items as Shown Below I Used Query as below in my PHP to bring the Orders One By One and storing in array. SELECT COUNT(PL.EmailId) FROM OrderList PL WHERE CSVProductIds LIKE '2' OR CSVProductIds LIKE '%,2,%' OR CSVProductIds LIKE '%,2' OR CSVProductIds LIKE '2,%'; 1.Is it possible to get the same out put by using Single Query 2.Does using a like in mysql query slows down the dB when the table has more no of records i.e 40k rows

    Read the article

  • Performance difference in for loop condition?

    - by CSharperWithJava
    Hello all, I have a simple question that I am posing mostly for my curiousity. What are the differences between these two lines of code? (in C++) for(int i = 0; i < N, N > 0; i++) for(int i = 0; i < N && N > 0; i++) The selection of the conditions is completely arbitrary, I'm just interested in the differences between , and &&. I'm not a beginner to coding by any means, but I've never bothered with the comma operator. Are there performance/behavior differences or is it purely aesthetic? One last note, I know there are bigger performance fish to fry than a conditional operator, but I'm just curious. Indulge me. Edit Thanks for your answers. It turns out the code that prompted this question had misused the comma operator in the way I've described. I wondered what the difference was and why it wasn't a && operator, but it was just written incorrectly. I didn't think anything was wrong with it because it worked just fine. Thanks for straightening me out.

    Read the article

  • Comma seprated search in mysql query

    - by Ravi Kotwani
    I have search mechanism in my site. For that I have written a large conditional query. $sql = "select * from users where keyword like '%".$_POST['search']."%' OR name like '%".$_POST['search']."%'"; Now, I suppose I have following data on the site: ID Name Keyword 1 Sanjay sanjay, surani 2 Ankit ankit, shah 3 Ravi ravi, kotwani Now, I need the result such that when user writes "sanjay, shah" ($_POST['search'] = 'sanjay, shah') then records 1 and 2 should be displayed. Can I achive this in single mysql query?

    Read the article

  • Populating form fields with comma seperated strings in unordered list onclick with jQuery/Javascript

    - by RyanP13
    Hi, I have an address lookup system which returns addresses in an unordered list like so: <p>Please select your address from the list below</p> <div id="selectAddress"> <ul> <li>HNO 412,addressLine2,addressLine8</li> <li>HNO 413,addressLine2,addressLine8</li> <li>HNO 414,addressLine2,addressLine8</li> </ul> </div> When someone clicks on an li containing the address i use the folloqing jQuery to split it and populate the following form fields. var $customerAddress = $("form#detailsForm input[name*='customerAddress']"); $("div#selectAddress ul li").click(function(){ $(this).removeClass("addressHover"); $("li.addressClick").removeClass("addressClick"); $(this).addClass("addressClick"); var $splitAddress = $(this).text().split(","); $($customerAddress).closest("tr").removeClass("hide"); $($customerAddress).each(function(){ var $inputCount = $(this).index($customerAddress); $(this).val($splitAddress[$inputCount]); }); $.cookies.set('cpqbAddressInputs', 'visible'); }); Form fields: <tr> <th> <label for="customerAddressLine1">Address&nbsp;*</label> </th> <td colspan="3"> <input type="text" name="customerAddressLine1" maxlength="40" value="" id="customerAddressLine1" class="text" /> </td> However it only seems to populate the first line of the address and not lines two and three. I could easily do this manually but i wanted to abstract it so that it could be expanded to cater for any amounts of address lines.

    Read the article

  • Python try...except comma vs 'as' in except

    - by peter
    What is the difference between ',' and 'as' in except statements, eg: try: pass except Exception, exception: pass and: try: pass except Exception as exception: pass Is the second syntax legal in 2.6? It works in CPython 2.6 on Windows but the 2.5 interpreter in cygwin complains that it is invalid. If they are both valid in 2.6 which should I use?

    Read the article

  • how to ingore comma when returning json mvc

    - by Darcy
    Hi all, I'm returning JSON from my controller to my view in order to populate a jquery autocomplete textbox in MVC. The problem is, some of my data contains commas, and therefore is split by the autocomplete helper. Heres my code. Controller: public ActionResult GetData() { var data = repository.GetData(); return Json(data); } View (script): $.post("../MyController/GetData", function(data) { var evalData = eval(data) + ""; //formats the text $("#Data").autocomplete(evalData.split(","), { max: 500, matchContains: true }); }); As you can see, I am using the jquery .split helper to split the returned Json. Should I be using regex or should I go with a completely different approach?

    Read the article

  • how to return comma seperated values in oracle SP

    - by john
    If I have a simple query like: OPEN cursor FOR SELECT USER_ID FROM USER_TABLE WHERE USER_ID = V_SOME_USER; this will return records in different rows but how can I return the rows in the following format: 'userid1', 'userid2', 'userid3'.....'useridN' I want to do this because I want to send this off as a parameter to another stored procedure...Also, what is the limit on how big the string can be when passed to the SP as parameter

    Read the article

  • RegEx/Javascript validation: Don't allow comma as a valid character

    - by baldwingrand
    I'm doing Javascript validation on my number fields. I'm using RegEx to do this - first time RegEx user. I need the user to only enter numbers and decimals, but not commas. (i.e. 3600.00 is okay, but 3,600.00 is not). I can't figure out how to eliminate the commas as an accepted character. Any help is appreciated. Thanks! var filter = /^([0-9])/; if (!filter.test(txtItemAmount.value)) { msg += "Item amount must be a number.\n"; txtItemAmount.focus }

    Read the article

  • Export to csv in jQuery

    - by Rahul Joshi
    I am dynamically generating a div which is like : <div id='PrintDiv'> <table id="mainTable"> <tr> <td> Col1 </td> <td> Col2 </td> <td> Col3 </td> </tr> <tr> <td> Val1 </td> <td> Val2 </td> <td> Val3 </td> </tr> <tr> <td> Val11 </td> <td> Val22 </td> <td> Val33 </td> </tr> <tr> <td> Val111 </td> <td> Val222 </td> <td> Val333 </td> </tr> </table> </div> And there are lot more elements on the page as well. Now, how can i get a csv file like this : Col1,Col2,Col3 Val1,Val2,Val3 Val11,Val22,Val33 Val111,Val222,Val333 using jQuery ? need a file save dailog box too,like this : Thanks.

    Read the article

  • Escaping comma in java

    - by prasanna
    I have a string which is fed into the query as IN clause,which looks like this ('ACT','INACT') which is one of the parameters to a function inside a package.when a call is made to the function from java, it looks like this call package.function(1,2,3,('ACT','INACT'),4,5). When the package is called,i get error as wrong type of arguments. It is taking the values inside brackets as different values delimited by strings

    Read the article

  • How to put comma in counted numbers?

    - by Ronnie Chester Lynwood
    hey huys im counting my table with this code: $county = mysql_query("SELECT COUNT(id) from table where type = 'application'"); $county = mysql_result($county, 0); $applications = ''.$county.''; this give me result like 1156563. but I want to see it like 1,156,563 with commas. how can i do this?

    Read the article

  • convert std object class to comma seperated string

    - by Kwaasi Djin
    I have an std class object from twitter and i would like to take the ids array values and put them in a php variable $ids where $ids = (15761916,30144785,382747195,19399719). I imagine using a for loop and using phps implode but i'm not sure how to go about it. stdClass Object ( [ids] => Array ( [0] => 15761916 [1] => 30144785 [2] => 382747195 [3] => 19399719 ) [next_cursor] => 0 [next_cursor_str] => 0 [previous_cursor] => 0 [previous_cursor_str] => 0 )

    Read the article

  • IE showing "decimal" instead of "comma"

    - by John Stewart
    I am having an issue with a slider (implemented using Prototype) and IE7. Upon the slider value change I update a with the value such as "420,000". Now on all browsers other than IE7 this is display correctly. But on IE7 it is displayed as "420.000" .. my question is how did the "," become "." the page has UTF-8 meta tag. Any help?

    Read the article

  • comma in regex in String.replaceAll() method?

    - by kknight
    My code tries to replace "," with "/" in a string. Should I escape "," in the regex string? Both of the two code snippets generated the same results, so I am confused. Code snippet 1: String test = "a,bc,def"; System.out.println(test.replaceAll("\\,", "/")); Code snippet 2: String test = "a,bc,def"; System.out.println(test.replaceAll(",", "/")); Should I use "," or "\,"? Which is safer? Thanks.

    Read the article

  • php add thousandseperator without adjusting comma

    - by bobwah
    I'm looking for a way to use the php number_format function or something similar that will add the thousand seperator but will leave any decimal part of the number intatct without and formatting of this. For example: 39845.25843 = 39,845.25843 347346.8 = 347,346.8 1000000 = 1,000,000 Thanks

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >