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
  • 0 Votes
    1 Posts
    7 Views
    No one has replied
  • Generic column mapping

    csharp sql-server
    5
    0 Votes
    5 Posts
    0 Views
    J
    Ravikiran72p wrote: Is there any solution in Sqlserver or ssis or .NET solution to identify Generic Columns of excel(xls) and map to Sqlserver Table correctly. Create an "adaptor" (concept rather than a specific type of implementation) specific to each vendor. I suggest STRONGLY that you use extensive error checking on such an adaptor because that is the only way you will detect when they change the format. The vendor files are delivered to a vendor specific folder and that is used as a key to determine which adaptor is used to process them. The adaptor could be written in either SQL or C#. I would choose C# because it provides more flexibility for this sort of operation. Note that a C# solution need not go directly to the database. In can just output a file, with a fixed known format, which is then used as an import file to SQL Server. The adaptors should also have error reporting, logging is good, to report on failed conversion attempts, as well as when successful ones ran.
  • 0 Votes
    9 Posts
    0 Views
    M
    thanks Richard this is a good solution
  • SSE 2008 R2 Backup Strategy

    database adobe sysadmin question career
    7
    0 Votes
    7 Posts
    0 Views
    R
    GuyThiebaut wrote: I take it there there is one central instance of an SQL Server rather than an instance on each workstation. If there is one central instance then try to get it off the OS drive(probably the C: drive) so that disk access is not competing between OS calls and SQL Server calls - does that make sense? Yes - one server instance on the server. Any yes I see what you mean. It makes sense, and I do remember reading something like that, but when I installed, I seemed to have missed where I could specify a different install location, so it installed on the C: drive (default).. At the moment there are way more serious performance hits in the app itself (populating too many datagrid rows at a time etc) - Only realized this when I got a copy of their data a year after the initial installation... I'd been testing with a bare bones DB on my machine - so yeah what those poor users have been going though - aw shame!
  • MariaDB on Linux

    question database mysql linux
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Conversion failed in sql

    database help business
    9
    0 Votes
    9 Posts
    1 Views
    M
    Richard.Berry100 wrote: what does J-script convert '12r' to??? Dammed if I know, as a Silverlight dev I don't have to get my hands grubby by rabbiting around in script languages. The r probably stands for a currency sign, I image the conversion just drops the non numeric characters and turn the rest to an integer. Never underestimate the power of human stupidity RAH
  • 0 Votes
    10 Posts
    0 Views
    R
    Yip, agreed, see the reply I posted to my own question with speed tests on various approaches, and reference to Eddy's link - Thanks!
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • Recursively build a string

    oracle tutorial
    4
    0 Votes
    4 Posts
    0 Views
    L
    Thanks Niral.. Your code was very helpful. It helped point me in the right direction. Much appreciated!
  • Need a query to get data from two tables with specific format

    database
    3
    0 Votes
    3 Posts
    0 Views
    N
    I am not sure what database you are using, but below is the query which resolves your problem and that works well in Oracle 11g. SELECT MSGNUM, LISTAGG(DESCR, ',') WITHIN GROUP (ORDER BY LVL) AS MSGDESCR FROM (SELECT DISTINCT MSGNUM, LEVEL LVL ,SUBSTR(NVL2(MSGNUM, MSGNUM || ',', NULL) ,(CASE WHEN LEVEL > 1 THEN INSTR(NVL2(MSGNUM, MSGNUM || ',', NULL), ',', 1, LEVEL - 1) + 1 ELSE LEVEL END) ,INSTR(NVL2(MSGNUM, MSGNUM || ',', NULL), ',', 1, LEVEL) - (CASE WHEN LEVEL > 1 THEN INSTR(NVL2(MSGNUM, MSGNUM || ',', NULL), ',', 1, LEVEL - 1) + 1 ELSE LEVEL END) ) MSGNUM_TO_ID FROM -- REPLACE FOLLOWING BLOCK WITH YOUR FIRST TABLE (SELECT SYSDATE - 1 STARTDATE, '1,2,3' MSGNUM FROM DUAL UNION SELECT SYSDATE - 2 STARTDATE, '4' MSGNUM FROM DUAL UNION SELECT SYSDATE - 3 STARTDATE, '5,6' MSGNUM FROM DUAL UNION SELECT SYSDATE - 4 STARTDATE, '' MSGNUM FROM DUAL UNION SELECT SYSDATE - 5 STARTDATE, '4,2,5' MSGNUM FROM DUAL UNION SELECT SYSDATE - 6 STARTDATE, '' MSGNUM FROM DUAL) CONNECT BY INSTR(NVL2(MSGNUM, MSGNUM || ',', NULL), ',', 1, LEVEL) != 0 ) T1 -- REPLACE FOLLOWING BLOCK WITH YOUR SECOND TABLE ,(SELECT 1 ID, 'ONE' DESCR FROM DUAL UNION SELECT 2 ID, 'TWO' DESCR FROM DUAL UNION SELECT 3 ID, 'THREE' DESCR FROM DUAL UNION SELECT 4 ID, 'FOUR' DESCR FROM DUAL UNION SELECT 5 ID, 'FIVE' DESCR FROM DUAL UNION SELECT 6 ID, 'SIX' DESCR FROM DUAL) T2 WHERE T1.MSGNUM_TO_ID = T2.ID GROUP BY MSGNUM ; Thanks & Regards, Niral Soni
  • Tunig required for the below SQL.

    html database workspace
    4
    0 Votes
    4 Posts
    0 Views
    N
    Rearrange your WHERE clause as below - WHERE C.ROW_ID = T5.PR_EMP_ID AND T1.ROW_ID = T4.ROW_ID(+) AND T1.PR_POSTN_ID = T5.ROW_ID(+) --AND T1.PR_INDUST_ID = T6.ROW_ID(+) AND C.EMP_FLG(+) = 'Y' AND T1.CUST_STAT_CD IN ('Active','Inactive','Pending - Workflow Wizard') AND T1.X_CLIENT_TYPE IS NOT NULL Thanks & Regards, Niral Soni
  • Back up database Error

    help question csharp database visual-studio
    6
    0 Votes
    6 Posts
    0 Views
    L
    You're welcome. Easiest is using the Sql Management Studio, but it could also be done using TSQL; sp_attach_db [ @dbname= ] 'dbname' , [ @filename1= ] 'filename_n' [ ,...16 ] Source[^] Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
  • sqlserver not found

    database sql-server sysadmin help question
    2
    0 Votes
    2 Posts
    0 Views
    J
    I doubt you have installed a windows application into SQL Server 2008. Member 9999112 wrote: How can i over come this error. By actually providing real information. First this site is for the people who create applications not those who use them. So if you have an application that you got from somewhere then you need to go where you got it and ask there. This presumes of course that you already read all of the documentation that comes with the application. But if this is an application that your wrote yourself then you need to provide some more detail about the code that is failing.
  • SSIS XML Source (2012)

    sql-server database sysadmin xml question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    7 Posts
    0 Views
    J
    sobelhaj wrote: I would appreciate any help you can give me. Based on your description - a redesign would probably be the best thing. Why doesn't your record just have the following for where the last value is the count? Apple Fruit Granny Smith 2900
  • the output of select command

    help tutorial
    5
    0 Votes
    5 Posts
    0 Views
    S
    ok,I put all of codes here! ///In the getid.aspx page <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="authenticate1.aspx.cs" Inherits="hokm.Admin.authenticate1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void salam(object sender, EventArgs e) { Session\["field1"\] = sh1.Text; Response.Redirect("editinformation.aspx"); } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server" enctype="multipart/form-data" > <div dir="rtl"> <table> <tr class="style1"> <td width="3%" bgcolor="#FF6666"> Please enter your id number <br /> <br /> <asp:TextBox name="shomare" ID="sh1" runat="server"/> <br /> <br /> <asp:Button ID="Button1" Width="60" runat="server" Text="confirm" OnClick="salam" /> </td> </tr> </table> </div> </form> </body> </html> so I put the Id in session["field1"]; and in the editinformation.aspx protected void page\_Load(object sender, EventArgs e) { sh.Value = (string)Session\["field3"\]; } <td colspan="5">  ID number: <input name="shomare karmandy" disabled="disabled" id ="sh" runat="server" /> </td> name: you see that I have filled the id textbox with a value,and I want to do this with name input,but I dont know how should I use the database to access the name with this Id?????
  • the select command output

    question help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • update special row

    database help tutorial announcement
    6
    0 Votes
    6 Posts
    0 Views
    L
    BEGIN TRANSACTION CREATE TABLE Person ( ID INT IDENTITY(1,1) PRIMARY KEY, FIRSTNAME VARCHAR(50), LASTNAME VARCHAR(50) ) INSERT INTO Person VALUES ('John', 'Doe'), ('Code', 'Project') SELECT * FROM Person UPDATE Person SET FIRSTNAME = 'Peter' WHERE ID = 1 SELECT * FROM Person ROLLBACK Execute in SQL-Management Studio. You'll see two tables; one before, and one after the update. You will need a good book that introduces you to some basic SQL-constructions. Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
  • How To Use Pivot in SQL SERVER

    database sql-server sysadmin tutorial
    4
    0 Votes
    4 Posts
    0 Views
    S
    Refer below link Using PIVOT and UNPIVOT[^] Using PIVOT and UNPIVOT[^]
  • the insert command doesnt work

    help csharp database visual-studio sysadmin
    7
    0 Votes
    7 Posts
    0 Views
    Richard DeemingR
    This version is still susceptible to SQL Injection[^]. For example, try a password of: Robert');DROP TABLE Authenticate;-- "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer