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
  • Keep history table [modified]

    database help question announcement
    6
    0 Votes
    6 Posts
    0 Views
    S
    If your using SQL Server 2005 or greater have a look at the TSQL Output clause[^] this will give you access to the deleted and inserted tables that you normally get with a trigger. Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
  • 0 Votes
    19 Posts
    0 Views
    J
    Okay, I see how I may have misinterpreted the requirement. I thought he wanted to find mistakes where say a phone number was filled into the address field. My advice is free, and you may get what you paid for.
  • checking the fieldname in the table

    database sql-server sysadmin tutorial question
    7
    0 Votes
    7 Posts
    0 Views
    D
    Hi I don't have choice. My clients or users uploads their file in excel and from that excel file, i have to read the data and insert it into the sql server. suchita
  • ORA-01843: not a valid month - Error

    oracle csharp help
    6
    0 Votes
    6 Posts
    0 Views
    L
    You're welcome. :) Luc Pattyn [My Articles] Nil Volentibus Arduum The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.4
  • 0 Votes
    5 Posts
    0 Views
    M
    While there are system views which will identify the FKs between tables this is not a system issues but a data problem. You will need to craft a query that get the data you want the way you want it. There is no 'system' query/function etc that will service this requirement. It is a fairly simple excercise using either sub queries or left joins depending on the required output. Never underestimate the power of human stupidity RAH
  • 0 Votes
    2 Posts
    1 Views
    H
    I just found a solution it helped me a lot now. To remove all ""rowguid" column from all table in SQL server which used replication you just run this script "exec sp_removedbreplication" in sql query and then all rowguid column will be deleted. thanks, Han :)
  • moving column in sql

    database tutorial question
    7
    0 Votes
    7 Posts
    0 Views
    P
    What do you mean by change priority? Do you mean you want to affect how the result is ordered (in other words, how it is sorted)? Forgive your enemies - it messes with their heads My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
  • uniqueidentifier data type

    database help tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    J
    Hi, You should use DbType.Guid db.AddInParameter(command, "@FirstName", DbType.Guid, info.FirstName);
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • SQL with variable amounts of fields

    help database game-dev xml
    4
    0 Votes
    4 Posts
    0 Views
    D
    It looks to me as if you've got a many to many relationship there. A battle joins many attackers to many defenders. So you would have a table Battles which has a unique BattleId, plus AttackerId and DefenderId plus whatever other information you want to hold against a battle (date, location, whatever). Then you have a number of options. One option would be to have an Attackers table which holds BattleId and CreatureId for all the attackers, and another table Defenders which holds BattleId and CreatureId for all the defenders. Or another option would be to have just one table BattleCreatures which holds BattleId, ArmyId and CreatureId where ArmyId is either the AttackerId or the DefenderId depending which side the creature is on. Whether you separate out Attackers from Defenders into two separate tables or whether you have them all together in one table is a bit of a judgement call. There are arguments for and against both options.
  • Recordset Seek - multiple fields

    database regex question
    2
    0 Votes
    2 Posts
    0 Views
    L
    I think it means that it should concatenate the fields, and search for that. MSDN[^] states: If you need to specify a value for more than one field, use the VBA Array function to pass those values to the KeyValues argument of the Seek method. If you only need to specify one value, it is not necessary to use the Array function. Bastard Programmer from Hell :suss:
  • Access AS SQL Front End

    database sql-server sysadmin help question
    7
    0 Votes
    7 Posts
    0 Views
    J
    mjackson11 wrote: What do other people do? Per the other suggest that MS Access attempts to load all of it.... If that is the case then create a view(s) that limits the data set greatly. And link to that.
  • SQL 2005

    question database
    7
    0 Votes
    7 Posts
    0 Views
    J
    lyngocquy wrote: u didn't understand my problem No you don't understand my reply. 1. Your database design is wrong. 2. This problem is a specific example of why it is wrong. 3. I told you how to do the update with your existing design.
  • SQL Function problem

    sharepoint database help question
    3
    0 Votes
    3 Posts
    0 Views
    L
    Etienne_123 wrote: Anyone have any ideas why this won't work? What would it fill the variable with if FirstName does equall null? You'd better assign it directly without the IF statement, and use the [ISNULL](http://msdn.microsoft.com/en-us/library/ms184325.aspx)[[^](http://msdn.microsoft.com/en-us/library/ms184325.aspx "New Window")] function. Bastard Programmer from Hell :suss:
  • Get Percentages Of Rows With Date In Them - Grouped

    database help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • How to get rows having sum equal to given value

    question tutorial
    11
    0 Votes
    11 Posts
    0 Views
    L
    The problem is actually known as the subset sum problem as konduc pointed out, with a useful link. As your number of rows is limited, you should load them all in memory and go for a normal solution, not a database-centric SQL one. Now start studying the keywords and links given to you, and help yourself with Google and/or some books. No one is going to do your job for you. :) Luc Pattyn [My Articles] Nil Volentibus Arduum The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.4
  • A Grouping

    database help question
    6
    0 Votes
    6 Posts
    0 Views
    D
    Connect to the BPG table and all of its inner joins first. Then do a LEFT OUTER JOIN to your Accessions (A) table and it's joins. This will give you all of the group names and the 0's if there is nothing for that group. SELECT BPG.[GroupName], COUNT(A.[ProcedureID]) AS [Count] FROM [DB].[dbo].[table2] BPG LEFT OUTER JOIN ([DB].[dbo].[Accessions] A INNER JOIN [DB].[dbo].[table1] BP ON A.[ProcedureID] = BP.[ProcedureID] INNER JOIN [DB].[dbo].[table3] O ON A.[OrderID] = O.[OrderID] INNER JOIN [DB].[dbo].[table4] F ON O.[OrderingFacilityID] = F.[FacilityID] ) ON BP.[ProcedureGroup] = BPG.[ProcedureGroupID] WHERE ..... GROUP BY BPG.[GroupName] Brent
  • Write trigger for multiple tables

    database sql-server sysadmin announcement
    3
    0 Votes
    3 Posts
    0 Views
    C
    vishnukamath wrote: user can not update,delete,insert on tables.If user try to modify on sql server table need to show alert. Database permissions were designed specifically for what you are looking for. If you are implementing access controls using triggers, I would say that is not a good idea. :) Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
  • Date Convertion

    database tutorial question
    11
    0 Votes
    11 Posts
    0 Views
    P
    SELECT CONVERT(VARCHAR(10), GETDATE(), 105)</pre> Place your date inplace of Gatedate()