Search Results

Search found 37012 results on 1481 pages for 'sql query'.

Page 98/1481 | < Previous Page | 94 95 96 97 98 99 100 101 102 103 104 105  | Next Page >

  • .NET Error with Dynamic T-SQL

    - by Phillip Theriault
    I am trying to create a TableAdapter in .NET using a stored procedure, but I'm getting an error "Incorrect syntax near the keyword 'WHERE'". I have narrowed down the problem in the stored procedure to the following lines: IF @NumRows > 0 SET @SQL += N' WHERE T1.RowNumber BETWEEN 1 and 10' ELSE SET @SQL += N' WHERE T1.RowNumber > 0' @NumRows is an input parameter that defaults to 0. However, if I remove either of those lines everything works fine (both WHERE clauses work fine by themselves when there is no IF/ELSE statement). It almost looks like .NET is ignoring the IF/ELSE and attempting to add the WHERE clause twice. It also works fine if I change it like so: IF @NumRows > 0 SET @SQL += N'' ELSE SET @SQL += N' WHERE T1.RowNumber > 0' One of the WHERE clauses has been removed, and there's no longer a conflict on the .NET side. So I'm pretty sure it has to do with the 2 WHERE clauses, and not with anything else. The sproc runs perfectly fine in SQL Server, and it even runs in .NET despite the error if I click "Preview Data". The only problem is that it won't auto-populate the list of fields, which I need for creating a report. Has anybody seen this before and have a suggestion?

    Read the article

  • I cnn't use Database in SQL Azure!

    - by Nahid
    Hi, I am trying to use a Database in SQL AZURE. I have installed SQL Server 2008. I can Login SQL Azure and can use master Database. But I can't use other Database and I can't see any things in my object explorer. Its Show Error: "USE statement is not supported to switch between databases. Use a new connection to connect to a different Database." How can I use other database?

    Read the article

  • Visual Studio 2008 (C#) with SQL Compact Edition database error: 26

    - by Tommy
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) I've created a SQL compact database, included it in my application, and can connect to the database fine from other database editors, but within my application im trying using (SqlConnection con = new SqlConnection(Properties.Settings.Default.DatabaseConnection)) { con.Open(); } the connection string is Data Source=|DataDirectory|\Database.sdf I'm stumped, any insight?

    Read the article

  • SQL query: Last but one rank for user

    - by Derk
    My table structure looks like this: create table rankings ( id IDENTITY NOT NULL, user_id INT NOT NULL, game_poule_id INT NOT NULL, rank INT NOT NULL, insertDate DATETIME NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, FOREIGN KEY (game_poule_id) REFERENCES game_poules(id) ON DELETE CASCADE ); All old rankings of users per game are saved in this table. Now I want to have the last but one rank in the table for all users in a gamepoule. Has someone an idea how to achive this? Thanks

    Read the article

  • I cann't use Database in SQL Azure!

    - by Nahid
    Hi, I am trying to use a Database in SQL AZURE. I have installed SQL Server 2008. I can Login SQL Azure and can use master Database. But I can't use other Database. Its Show Error: "USE statement is not supported to switch between databases. Use a new connection to connect to a different Database." How can I use other database?

    Read the article

  • CakePHP model useTable with SQL Views

    - by Chris
    I'm in the process converting our CakePHP-built website from Pervasive to SQL Server 2005. After a lot of hassle the setup I've gotten to work is using the ADODB driver with 'connect' as odbc_mssql. This connects to our database and builds the SQL queries just fine. However, here's the rub: one of our Models was associated with an SQL view in Pervasive. I ported over the view, but it appears using the set up that I have that CakePHP can't find the View in SQL Server. Couldn't find much after some Google searches - has anyone else run into a problem like this? Is there a solution/workaround, or is there some redesign in my future?

    Read the article

  • Why won't this sql update query work?

    - by Wesley
    I have a table that has 5,000(table1) lines in it. Currently, 3,000 of them are filled up with data. The remaining values are currently null. In a separate table(table2), I have the remaining 2,000 rows of data. I am simply trying to take the values in table2 and put them in table1, but this statement isn't working: Update table1 Set field1 = (Select field1 From table2 Where table1.id = table2.id) Where Exists(Select field1 From table2 Where table1.id = table2.id) It looks like this should be working, but I am getting an error from Base, the db program I am using that just says error Near " ": syntax error...any help?? Thanks!

    Read the article

  • Determine Last Modification Datetime for an Azure Table

    - by embeddedprogrammer
    I am developing an application which may be hosted on a microsoft sql server, or on Azure SQL, depending upon the end user's wishes. My whole system works fine with the exception of some WCF functions which determine the last modification time of tables using the following technique: SELECT OBJECT_NAME(OBJECT_ID) as tableName, last_user_update as lastUpdate FROM mydb.sys.dm_db_index_usage_stats This query fails in Azure. Is there any analogous way to get table last modification dates from Azure's sql?

    Read the article

  • SQL query sample

    - by qods
    Hi, my table is look like this order.. I would like count the TermID's with these conditions; If it's possible also want to get resultset with these headers - TermID must have close or open status - TermID Status must turn to Open (close to open) - Status Date (open status) must be bigger date than close status date with my regards, ID TermID Status Date 103990107 103641 Close 28/05/2010 104000600 103641 Open 31/05/2010 103980976 106458 Close 26/05/2010 103990045 106458 Open 27/05/2010 103939537 106475 Open 18/05/2010 103908130 117220 Open 13/05/2010 103929653 117220 Open 13/05/2010 103999017 117360 Open 31/05/2010 103834814 117402 Open 05/05/2010 103993973 117420 Open 28/05/2010 103849795 119377 Close 05/05/2010 103955266 119377 Close 21/05/2010 103995229 119377 Close 29/05/2010 103979873 119704 Open 25/05/2010 103832225 119767 Open 04/05/2010 103925429 123229 Close 15/05/2010 103986986 123932 Open 27/05/2010

    Read the article

  • Time display query in sql

    - by shanks
    I have following data UserID UserName LogTime LogDate 1 S 9:00 21/5/2010 1 S 10:00 21/5/2010 1 S 11:00 21/5/2010 1 S 12:00 21/5/2010 Need Output as:- 1 s 9:00 10:00 21/5/2010 1 s 11:00 12:00 21/5/2010

    Read the article

  • .Net SQL Parameter for String List Problem

    - by JK
    I am writing a C# program in which I send a query to SQL Server to be processed and a dataset returns. I am using parameters to pass information to the query before it is sent to SQL server. This works fine except in the situation below. The query looks like this: reportQuery = " Select * From tableName Where Account_Number in (@AccountNum); and Account_Date = @AccountDate "; The AccountDate parameter works find but not the AccountNum parameter. I need the final query to execute like this: Select * From tableName Where Account_Number in ('AX3456','YZYL123','ZZZ123'); and Account_Date = '1-Jan-2010' The problem is that I have these account numbers (actually text) in a C# string list. To feed it to the parameter, I have been declaring the parameter as a string. I turn the list into one string and feed it to the parameter. I think the problem is that I am feeding the paramater this: "'AX3456','YZYL123','ZZZ123'" when it wants this 'AX3456','YZYL123','ZZZ123' How do I get the string list into the query using a parameter and have it execute as shown above? This is how I am declaring and assigning the parameter. SqlParameter AccountNumsParam = new SqlParameter(); AccountNumsParam.ParameterName = "@AccountNums"; AccountNumsParam.SqlDbType = SqlDbType.NVarChar; AccountNumsParam.Value = AccountNumsString; FYI, AccountNumString == "'AX3456','YZYL123','ZZZ123'"

    Read the article

  • Need Help Writing SQL query

    - by user204588
    I have two product tables Product1 and Product2. There is a one 2 one mapping on the field ProductId. What I want is to get all the product ids where the Product2.Exported field is false AND Where the product ids that are in Product1 but not in Product2 table. Right now I have two queries that I'm trying to mash into one. SELECT ProductId FROM Product1 WHERE ProductId NOT IN(Select ProductId From Product2) SELECT ProductId FROM Product2 WHERE Exported = 0

    Read the article

  • Date & time query question (sql-server 2008)

    - by Gold
    hi i have table that contain date and time field. id|date|time ========= 1|01/01/2001|10:45 2|01/02/2002|11:45 3|01/03/2003|12:45 4|01/04/2004|12:55 i need to know the difference between the MAX(date) and the MIN(date) and the MAX(time) and the MIN(time) something like.... MAX(date)-MIN(date) ???..... thank's in advance

    Read the article

  • Displaying Query Results Horizontally

    - by AndyD273
    I am wondering if it is possible to take the results of a query and return them as a CSV string instead of as a column of cells. Basically, we have a table called Customers, and we have a table called CustomerTypeLines, and each Customer can have multiple CustomerTypeLines. When I run a query against it, I run into problems when I want to check multiple types, for instance: Select * from Customers a Inner Join CustomerTypeLines b on a.CustomerID = b.CustomerID where b.CustomerTypeID = 14 and b.CustomerTypeID = 66 ...returns nothing because a customer can't have both on the same line, obviously. In order to make it work, I had to add a field to Customers called CustomerTypes that looks like ,14,66,67, so I can do a Where a.CustomerTypes like '%,14,%' and a.CustomerTypes like '%,66,%' which returns 85 rows. Of course this is a pain because I have to make my program rebuild this field for that Customer each time the CustomerTypeLines table is changed. It would be nice if I could do a sub query in my where that would do the work for me, so instead of returning the results like: 14 66 67 it would return them like ,14,66,67, Is this possible?

    Read the article

  • Group mysql query by 15 min intervals

    - by gsiener
    I've got a monitoring system that is collecting data every n seconds (n ~=10 but varies). I'd like to aggregate the collected data by 15 minute intervals. Is there a way to corral the timestamp column into 15 minute chunks to allow for grouping to work?

    Read the article

  • Query to check the consistency of records

    - by orunner
    I have four tables TableA: id1 id2 id3 value TableB: id1 desc TableC: id2 desc TableD: id3 desc What I need to do is to check if all combinations of id1 id2 id3 from table B C and D exist in the TableA. In other words, table A should contain all possible combinations of id1 id2 and id3 which are stored in the other three tables.

    Read the article

  • How to get values from SQL query made by php?

    - by Ole Jak
    So I made a query like this global $connection; $query = "SELECT * FROM streams "; $streams_set = mysql_query($query, $connection); confirm_query($streams_set); in my DB there are filds ID, UID, SID, TIME (all INT type exept time) So I am triing to print query relult into form <form> <select class="multiselect" multiple="multiple" name="SIDs"> <?php global $connection; $query = "SELECT * FROM streams "; $streams_set = mysql_query($query, $connection); confirm_query($streams_set); $streams_count = mysql_num_rows($streams_set); for ($count=1; $count <= $streams_count; $count++) { echo "<option value=\"{$count}\""; echo ">{$count}</option>"; } ?> </select> <br/> <input type="submit" value="Submit Form"/> </form> How to print out as "option" "values" SID's from my sql query?

    Read the article

  • T-SQL Query to Get SUM(COUNT())

    - by Ted
    Hi, I am planning to get a report for a table with following table structure: ID RequestDate ----------------------------- 1 2010/01/01 2 2010/02/14 3 2010/03/20 4 2010/01/07 5 2009/03/31 I want the results as: I D_Count RequestDate Sum ----------------------------------------- 2 2010/01 2 1 2010/02 3 2 2010/03 5 Pls help.

    Read the article

  • SQL Server > Query > Column Names

    - by pojomx
    Hi, I'm here again- I have something like this Select A.a, A.b, A.a+A.b as c, (A.a+A.b*2)+A.d as d from Table But i want to know, if it is possible, to make it work with something like this: Select A.a,A.b,A.a+A.b as c, (c*2)+A.d as d from Table Thank you

    Read the article

  • SQL installation scripts for WebCenter Content 11g

    - by KJH
    As part of the installation of WebCenter Content 11g (UCM or URM), one of the main functions is to run the Repository Creation Utility (RCU) to establish the database schema and tables.   This is pretty helpful because it runs all the scripts you need to have without having to manually set anything up in the database.   In UCM 10g and earlier, the installation  itself would establish the database tables if you wanted it to.  Otherwise, the SQL scripts were available to be run independently ahead of time.  For DBAs who wanted to understand what was being done to the database for the application, this was helpful for them.  But in 11g, that is all masked now in RCU.  You don't get to see the scripts at all as part of it's establishing the tables.  But if you comb through the directories for RCU, you can track them down.  They are in the  /rcuHome/rcu/integration/contentserver11/sql/ directories.  And to understand the order in which they are run, you can open up the /rcuHome/rcu/integration/contentserver11/contentserver11.xml file and see how they are run there.  The order in which they are run are: contentserverrole.sql contentserveruser.sql intradoc.sql workflow.sql formats.sql users.sql default.sql contentprocedures.sql  If you are installing WebCenter Records (URM), it will run some additional scripts between the formats.sql and users.sql : MetadataSet.sql UIEnhancements.sql RecordsManagement.sql RecordsManagement_default.sql ClassifiedEnhancements.sql ClassifiedEnhancements_default.sql In addition to the scripts being available within the RCU install directories, they are also available from within the Content Server UI.  If you go to Administration -> DataStoreDesign SQL Generation, this page can allow you to download these various SQL scripts.    From here, you can select your particular database type and which components to include.  Several components make changes dynamically to the database when they are enabled, so these scripts give you a way to inspect what is being run during that startup time.  Once selected, click Generate and you now can either view or download the scripts from the Actions menu. DISCLAIMER:  Installations are ONLY supported when done with the Repository Creation Utility.  These scripts are for reference only and not supported to be run manually.

    Read the article

  • "t-sql" tool for csv files?

    - by adolf garlic
    Is there a tool that allows to query files based on the following criteria, and change them? creation date filenames (e.g. filetypeA_YYYYMMDD_data2.blah) file content For the example, the workflow could be the following one: Get all files created between date x and date y, where the filename contains z and the file itself contains value x under column zzz. Update it to be a different value/another column.

    Read the article

  • ???????/???Oracle SQL Developer??????????????

    - by user788995
    ????? ??:2012/01/23 ??:??????/?? SQL Developer ??SQL?PL/SQL???????????????GUI??????SQL Developer ????????????·??????????SQL?? SQL?????????PL/SQL??????????????????????????SQL Developer ???????Unit Test?????????????????? SQL Developer ????????·???????????/?????????DBA???? ????????? ????????????????? http://otndnld.oracle.co.jp/ondemand/otn-seminar/movie/111227_E-9_SQL.wmv http://otndnld.oracle.co.jp/ondemand/otn-seminar/movie/mp4/111227_E-9_SQL.mp4 http://www.oracle.com/technetwork/jp/ondemand/db-technique/e-9-sql-developer-1484606-ja.pdf

    Read the article

< Previous Page | 94 95 96 97 98 99 100 101 102 103 104 105  | Next Page >