Skip to content

Database

Discussions on database access, SQL, and ADO

This category can be followed from the open social web via the handle database@forum.codeproject.com

17.1k Topics 61.8k Posts
  • Get Filename and import fixed width file

    database sql-server question
    4
    0 Votes
    4 Posts
    0 Views
    L
    None; yes, it could be done using a sproc. Yes, you can list directories, manipulate strings. How much of this sproc have you written yet? Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • how to get random 6 records from sqlserver2005 database

    database tutorial lounge
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • .

    7
    0 Votes
    7 Posts
    0 Views
    L
    SQL Ed wrote: Please don't respond to my questions anymore I could promise now, but would probably forget your name in a week. SQL Ed wrote: i didn't post a question for some punk kid to use profane language. The "friggin" was superfluous. It was partly an emotional response, something that simply seems to happen whenever I meet a 'solution' without a problem. As is, the requirement does not add value, on the contrary, it makes things more complex and error-prone. SQL Ed wrote: Because we are using the code in a 3rd party application,the requirements call for keeping all the code in a single stored proc. As hard as it may sound, but IMO that's where the error is. Unless there's a very good justification (besides the remark that it's a requirement), I'd still suggest fixing the problem at it's root. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • SQL 2000 to 2008R2 Query Performance

    database design performance question learning
    12
    0 Votes
    12 Posts
    2 Views
    C
    Might have found something, a high number of CXPACKET waits. We've set the MAXDOP to 1 to see if we now get consistent performance, if we're lucky it will consistent performance that matches the old server...
  • 0 Votes
    2 Posts
    0 Views
    H
    Have you read this. Second answer in that thread tells you the options are very limited for IP retrieving in Sql Server 2000 In Word you can only store 2 bytes. That is why I use Writer.
  • 0 Votes
    2 Posts
    0 Views
    J
    A case when clause can only return values, not conditions. Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
  • SQL counting

    database help
    7
    0 Votes
    7 Posts
    0 Views
    Q
    I agree with you that doing anything causes more problems eventually. Myself i would not have brought the data forward until all fields are present from source file. But i do not make that choice and i got involved after project was started. This is more of a transactional system then data warehouse like they said. Hate to say it but it goes back to the way it was architected and going forward from there has been to get it to work. Very complex data modeling which i would have simplified by bringing it in and leveling data types. They chose to bring it forward anyway and then leave just before the DW level. Makes no sense but i wasnt in on those meetings. I get to deal with it and figure out if the data is accurate. Fun times. :)
  • Problem in Import XML File From SSIS

    xml database sql-server com linux
    2
    0 Votes
    2 Posts
    0 Views
    M
    i tried to use OPENROWSET like that but it's not work can you modify it DECLARE @xml XML SET @xml = ' 648 Moustord 5 646 Shell 9 647 Suze 4 ' ;WITH XMLNAMESPACES( 'http://www.w3.org/2001/XMLSchema' AS ns, 'urn:schemas-microsoft-com:xml-diffgram-v1' AS diffgr ) SELECT fd.c.value('(ID/text())[1]', 'INT') 'a', fd.c.value('(NodeGroup/text())[1]', 'nvarchar(255)') 'b', fd.c.value('(NodeCount/text())[1]', 'INT') 'c' FROM @xml.nodes('ns:DataSet/diffgr:diffgram/NewDataSet/T') fd(c)
  • Problem with MySQL stored procedure

    database help csharp sharepoint mysql
    9
    0 Votes
    9 Posts
    0 Views
    J
    I even tried this simple delete but still not working. No error and records not getting deleted!!! sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString); sql_command = new MySqlCommand("sp_delete_channel", sql_connection); sql_command.CommandType = CommandType.StoredProcedure; sql_connection.Open(); sql_command.Parameters.AddWithValue("param_channel_id", channel_id).MySqlDbType = MySqlDbType.Int32; int result_row = sql_command.ExecuteNonQuery(); and SQL: CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_delete_channel`(IN param_channel_id int, IN param_volow_member_id int, OUT param_is_channel_created bit) BEGIN DELETE FROM member_posts WHERE member_channel_id = param_channel_id; DELETE FROM member_channels WHERE member_channel_id = param_channel_id; IF NOT EXISTS (SELECT member\_channel\_id FROM member\_channels WHERE volow\_member\_id = param\_volow\_member\_id) THEN BEGIN UPDATE volow\_members SET is\_channel\_created = FALSE; SET param\_is\_channel\_created = FALSE; END; ELSE SET param\_is\_channel\_created = TRUE; END IF; END
  • 0 Votes
    5 Posts
    1 Views
    L
    Dan_K wrote: I tried in my own way which works fine now. My BackgroundWorker thread creates a new thread and the created thread rather calls SqlConnection.Open(). When the cancel button is clicked, the BackgroundWorker thread aborts the thread opening the connection. That's what the OpenAsync in 4.5 will do; open the query on a backgroundthread, polling it's status. Dan_K wrote: It works fine although I don't know if there could be any related problems. Opening a connection can fail for multiple reasons, and exceptions aren't casted across the thread. You might want to make sure you have a good exception-handler in there; if you have the time, then it'd be mighty cool to have a "try connecting again" function - that way people won't have to relaunch the app after they found out that the database-server wasn't powered on. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • 0 Votes
    7 Posts
    0 Views
    M
    Ugh, nasty, especially when you mix other clients into the data, I would suggest this could only be fixed by a custom script, charge them a fortune as a lesson and hope like hell you can deliver. I would then implement a logging/audit strategy on the database or separate each client to their own environment. If you screw up another clients data b/c of this issue your whole business case just went out the window! Never underestimate the power of human stupidity RAH
  • How to Recover Deleted rows from sql 2000 Database

    database tutorial
    3
    0 Votes
    3 Posts
    0 Views
    L
    There is no inbuilt-mechanism to restore or read deleted rows in SQL Server 2000. You must implement logical deletes instead of physical deletes to be able to achieve that. (For example, an IsDeleted(bit) column in every table). As Eddy suggested, the only other ways is to work on a restored copy of the database.
  • MySQL Server timestamp changed!

    question mysql sysadmin help
    2
    0 Votes
    2 Posts
    0 Views
    L
    IMO, MySQL does not have its own date/time storage. Check your system's date/time.
  • Connection String for Ms access 2010 to Windows 7 64 Bit

    help
    2
    0 Votes
    2 Posts
    0 Views
    L
    See here[^]. One of these days I'm going to think of a really clever signature.
  • Windows Run Command

    database sql-server sysadmin help question
    18
    0 Votes
    18 Posts
    0 Views
    L
    You can use Google Translate to go from English to your language. There are no alternatives to the ones mentioned in the documentation. Hence, you'll have to find another way to do what you need. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • cannot find column

    database help question announcement career
    2
    0 Votes
    2 Posts
    0 Views
    L
    UPDATE bonuses Set bonus=10000 FROM bonuses D JOIN cbonuses1 E ON D.employee_id = S.employee_id) Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • MySQL sql statement question

    database mysql question
    4
    0 Votes
    4 Posts
    0 Views
    L
    jrahma wrote: but there is one problem. We call it a JOIN. Try Visual Representation of SQL Joins[^] :) Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • MySQL Question

    android ios mobile mysql sysadmin
    2
    0 Votes
    2 Posts
    0 Views
    L
    SQL Ed wrote: I keep getting a syntax error On which line? I suggest you comment out blocks of sql, until you have a working version. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • Removing the updated row

    help tutorial announcement
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    5 Posts
    0 Views
    J
    Eddy Vluggen wrote: Not guaranteed to execute indeed Well thats kinda the point of a finally block.