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
  • SSIS and parsing empty strings to integers

    sql-server question database help csharp
    5
    0 Votes
    5 Posts
    0 Views
    S
    The problem you are experiencing is a data type issue. The source is varchar, which means SSIS read and mapped the source adaptor to varchar and its output column to varchar. Inserting that varchar into the int caused your problem. To prevent this issue, in the data flow task -> Right click on the source -> scroll down to “Show Advanced Editor” Select “Input and Output Properties” Navigate down to “Output Columns” Locate the column in question and change the data type to something more appropriate such as “four-byte signed integer [DT_I4]” SSIS tries to guess what the source data type is and land it in the same data type without knowing everything in advance. SSMS builds the query first with the set of data then does the insert, so it knows to recast the data to the proper type. You could also change the error handling of the destination object to ignore the error. While this works as well it could lead to other issues and is less than desirable. Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
  • SUM Problem in MSSQL

    question sql-server help
    7
    0 Votes
    7 Posts
    0 Views
    L
    You actually *read* it? Ehr.. you're welcome, and yes, well done :) Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • 0 Votes
    5 Posts
    0 Views
    C
    :thumbsup:
  • Find phonetic word in SQL

    database algorithms help tutorial question
    5
    0 Votes
    5 Posts
    0 Views
    C
    Hi nagy, Thank you for your answer, I used MY SQL, and I've used soundex, but it return too many result which not match to my keyword, how about you idea bro? Thank you, Regards.
  • 0 Votes
    6 Posts
    0 Views
    L
    I've tried it both ways, with @chassis_search and using #Chas. The tried it because the other SP selects a large range of values into it and then runs the exact same from the first insert on out. It works, this one doesn't. I block wildcards on the software side so I'm not to concerned about wildcard entries. I'm used to visual studio using = when a parameter is required.
  • How to join two sql queries together?

    database csharp sysadmin tutorial question
    7
    0 Votes
    7 Posts
    2 Views
    T
    Someone helped me come up with this code today, it appears to be producing the proper results, what does every one think? It uses And UserName Not In, and brings in the second search to compare. -- Mailbox size query users who are set to unlimited, distinct username field with disabled mailboxes removed from search SELECT AED.ObjectName, AED.ObjectCanonical, AEM.EventMessage, AED.OrganizationalUnit AS DirectoryOrganizationalUnit, AET.UserName, AET.SeverityID, AET.TimeDetected, AET.ValueOld, AET.ValueNew, ECS.SubsystemID, ISNULL(ECS.CustomEventClassName, ECS.EventClassName) AS EventClassName, ISNULL(TSR.ServerName, TWP.MachineName) AS ServerName, EAN.ActionName, ISNULL(TDN.DomainName, TWP.WorkgroupName) AS DomainName, AET.ResultID, AET.EventID, ECS.ValueTypeID, AET.MissingOld, AET.MissingNew, AET.TimeZoneOffset FROM Audit.Event AS AET INNER JOIN [Event].Class AS ECS ON AET.EventClassID = ECS.EventClassID INNER JOIN Audit.EventMessage AS AEM ON AET.EventID = AEM.EventID INNER JOIN [Event].[Action] AS EAN ON AET.ActionID = EAN.ActionID LEFT OUTER JOIN Topology.[Server] AS TSR ON AET.AgentID = TSR.ServerID LEFT OUTER JOIN Topology.Domain AS TDN ON TSR.DomainID = TDN.DomainID LEFT OUTER JOIN Topology.Workgroup AS TWP ON AET.AgentID = TWP.MachineID LEFT OUTER JOIN Audit.EventDirectory AS AED ON AET.EventID = AED.EventID WHERE AET.TimeDetected >= '2012-06-08T04:00:00' AND EXISTS(SELECT AET.EventID FROM [Event].Class AS _EC WHERE EXISTS(SELECT * FROM Query.EventClass AS _ECQ WHERE _ECQ.QueryID = '2E84F194-03D0-4218-A346-76C50B98E36A' AND _ECQ.ProcessID = 0 AND StorageClassID = 0 AND _ECQ.EventClassID = _EC.EventClassID) AND _EC.EventClassID = AET.EventClassID) AND NOT EXISTS(SELECT * FROM (SELECT _QA.SID AS UserSID FROM Query.[Account] AS _QA WHERE _QA.QueryID = '2E84F194-03D0-4218-A346-76C50B98E36A'
  • 0 Votes
    6 Posts
    0 Views
    P
    That is very very bad. Highly inefficient. You convert every (millions?) SaveDate value and then do a string compare -- which is much less efficient than the DATETIME compare would be. <anecdote> I once fixed a program that was written that way -- before I fixed it it took forty minutes to run, afterward it took only ten minutes. </anecdote> DON'T EVER DO THAT!! :mad: :mad: :mad: :mad: :mad: :mad:
  • 0 Votes
    12 Posts
    0 Views
    D
    I agree that seeing a difference in a schema does not tell you how you got there, but the simple matter of detecting a change will initiate an investigation. No change = No problem (ideally) Change = Investigation When there is team development on an application there must be communication among the team to reflect any changes. Using a source control system like Subversion is a good way to see changes made and designating a single person as the responsible party for making any changes to the schema is also a good idea.
  • 0 Votes
    4 Posts
    0 Views
    P
    That's probably not worth the effort; just catch the Exception in the calling code. And don't prefix your procedures with sp_ -- that's for System Procedures.
  • Persistent storage of measuring results

    database sqlite sysadmin question
    10
    0 Votes
    10 Posts
    0 Views
    L
    Thank you for your answer. The data is used only to restore the last program state. There is an additional export feature - so I think SQLite ore SQL CE will achieve what I want. Alex
  • Connect to MySQL server

    sysadmin c++ database mysql help
    9
    0 Votes
    9 Posts
    0 Views
    P
    Have you tried using port forwarding as Bernhard has suggested? "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
  • Import excel data in SSRS

    sql-server database sysadmin help
    2
    0 Votes
    2 Posts
    0 Views
    N
    check this link http://weblogs.sqlteam.com/joew/archive/2008/08/22/60695.aspx[^]
  • Please help the problem

    help csharp visual-studio sysadmin
    2
    0 Votes
    2 Posts
    0 Views
    R
    Does the test server have everything installed that your desktop has? The same versions? Have you installed your application correctly? With everything it needs? "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
  • I need your help to solve a problem.

    database help csharp asp-net sql-server
    10
    0 Votes
    10 Posts
    0 Views
    D
    Ah ha. I see. From my understanding if the SQL server and the Oracle Server are local, then the communication between the two should be pretty secure. I would ensure that the user accounts that you are using from your web server has the minimum privilege necessary to get the job done. You don't want to be connecting as "sa" incase your application gets hacked. During your application development, make sure you use parameterized queries to limit the exposure to SQL injection.
  • Get records having different data in 2 rows

    database question
    13
    0 Votes
    13 Posts
    0 Views
    L
    SELECT DISTINCT A.Acc_No,count(*) FROM [Test].[dbo].[Table_2] A JOIN [Test].[dbo].[Table_2] B on A.Emp_state = B.Emp_state group by A.Acc_No having COUNT(*)>1
  • Joining 4 Tables

    help learning
    6
    0 Votes
    6 Posts
    0 Views
    L
    Select TblA.*,TblB.*,TblC.*,TblD.* from persons TblA inner join Education TblB on TblB.PersonID = TblA.PersonID inner join Skills TblC on TblC.PersonID = TblA.PersonID inner join JobHistory TblD on TblD.PersonID = TblA.PersonID
  • cannot add or change a record

    help question
    12
    0 Votes
    12 Posts
    0 Views
    P
    Shameel wrote: the singer is the writer I don't think the OP is concerned with the writer at all. And if he wanted to track writers he would still be best served by a many-to-many schema.
  • Please help me for this qusetion

    help question
    5
    0 Votes
    5 Posts
    0 Views
    _
    I have modified the solution to include the dynamic query.
  • how to start Schema design?

    help database com design xml
    5
    0 Votes
    5 Posts
    0 Views
    L
    Learn to Normalize. A simple set of rules that can be applied to any collection of facts, and which results in a relational and normalized dataset. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • My SQl error while sending to database

    database help question
    6
    0 Votes
    6 Posts
    1 Views
    L
    Dunno, but it works without any mark too. I only use the @-sign within the Sql-statement, the AddWithValue method always without. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]