Skip to content
Code Project
CODE PROJECT For Those Who Code

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
    2 Posts
    0 Views
    M
    Look into unpivot, I've never actually had to do this but pivot work fine so I assume unpivot will also. Never underestimate the power of human stupidity RAH
  • 0 Votes
    5 Posts
    0 Views
    L
    Alivemau5 wrote: What is the correct approach? Determining the "cost" of recalculating the results. If it takes a lot of time to reproduce the data, then store it :) I are Troll :suss:
  • Help with T-SQL Statement??

    database tools help question
    4
    0 Votes
    4 Posts
    0 Views
    M
    If what exists, the structure does not make sense, you are selecting a row and then ask if something exists. Change the script to: DECLARE @Count INT SELECT @Count = COUNT(*) FROM sys.dm_db_index_physical_stats (DB_ID(N'Backdrop'), OBJECT_ID(N'DBO.table'), NULL, NULL , 'DETAILED') WHERE [avg_fragmentation_in_percent] < 30 IF @Count > 0 Never underestimate the power of human stupidity RAH
  • table join

    2
    0 Votes
    2 Posts
    0 Views
    M
    Oh dear have you got a problem. Looks like you are using the instructors name as a key field for joining tables - WRONG. Each table should have an ID field (usually and int IDENTITY(1,1)) as the primary key and then a foreign key to maintain data integrity. Your join structure is wrong. A left join to UCV2 and THEN a right join the to class means that you will get records, wait I'm have no idea what you would get but it would be a mess. Take a look at this Visual Representation of SQL Joins[^] for some clarification Never underestimate the power of human stupidity RAH
  • Dynamic CrystalReports

    question
    3
    0 Votes
    3 Posts
    0 Views
    E
    pls i have done this already, i get an error: this report does not have a table. pls help. thanks
  • Database design question

    question database visual-studio design windows-admin
    13
    0 Votes
    13 Posts
    0 Views
    P
    No, and it would leave room for more in the future. And maybe you would use it as the base for other sports, like American football or baseball or who knows what. It's a proper pattern to use anyway, even if there are only two entries.
  • login

    database security question
    4
    0 Votes
    4 Posts
    0 Views
    F
    Thanks alot for your attention; I change server authentication form windows authentication mode to sql server and windows authentication mode;and after that i create new login and i set password and i enabled login . but these changes doesn't done and when i want to ok these changes , an error occured:(what should i do) TITLE: Microsoft SQL Server Management Studio ------------------------------ Create failed for Login ''. (Microsoft.SqlServer.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.4035.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Login&LinkId=20476 ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name. (Microsoft SQL Server, Error: 1038) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=1038&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------
  • 0 Votes
    5 Posts
    0 Views
    J
    Swelborn wrote: This worked and it was the concatenation of the FirstName and LastName's Yup, that was on Line 4 [of the dynamic part] - exactly as the error message prompted.
  • 0 Votes
    3 Posts
    0 Views
    B
    Thank you for the quick reply. I apologize for the posting in the wrong location. This crossed over to several areas, so I wasn't sure where it fit best. I'm admittedly new to working with .NET and data access, having done most of my Windows coding in Delphi recently. Time to shift some paradigms, but that's just fine with me. :) Thanks again! - Bert
  • 0 Votes
    4 Posts
    0 Views
    M
    3 Servers is a requirement, dev, uat and production. If/when we have a major deployment and can sync all the servers from production we do this. It does not happen very often as the development almost never stops so all the servers have different versions. But then we have something like 14 apps under production. We also have another server for bug tracing, take a snapshot of the production server and chase down the problem. We also use SQL compare and data compare to do deployment, greatest time save ever for deployment. Never underestimate the power of human stupidity RAH
  • Group ranking or row number

    help
    3
    0 Votes
    3 Posts
    0 Views
    M
    This will make interesting reading[^] for you. Also look into PARTITION and RANK, that will allow you to rank the records over the group Never underestimate the power of human stupidity RAH
  • Is this query bad.....?

    question database performance code-review
    5
    0 Votes
    5 Posts
    0 Views
    P
    I am sure about SQL Server, Oracle and Sybase but no idea about other DB servers. WWW, WCF, WWF, WPF, WFC .... WTF
  • Need help with creating a view

    database help tutorial question
    5
    0 Votes
    5 Posts
    1 Views
    M
    Dimitry -- I now have to add one additional field but this one is harder. Each contact has an AccessGranted table tied to them with the locations they can access. I need to reduce that table down to a boolean CanAccess. How do I do something like that when I don't really have a customer key to work with. This is what my view looks like right now: SELECT TOP (100) PERCENT dbo.CustomerMaster.BSACustomerKey, dbo.ContactMaster.ContactName, dbo.ContactMaster.BusinessPhone, dbo.ContactMaster.MobilePhone, dbo.ContactMaster.Email, dbo.ContactMaster.FirstName, dbo.ContactMaster.LastName, dbo.ContactMaster.EmergencyMaintenance, dbo.ContactMaster.NormalMaintenance, dbo.ContactMaster.NetworkAbuse, dbo.ContactMaster.IssuedSwipeCard, dbo.ContactMaster.CardNumber, dbo.AddressList.CustomerAddressLine1, dbo.AddressList.CustomerAddressLine2, dbo.AddressList.CustomerAddressLine3, dbo.AddressList.CustomerPostBox, dbo.CityEnumerator.City, dbo.StateEnumerator.State, dbo.AddressList.CustomerCounty, dbo.AddressList.CustomerCountry, dbo.AddressList.CustomerZipcode, dbo.ContactMaster.BmcCustKey, CASE WHEN dbo.ContactMaster.Role = 1 THEN 1 ELSE 0 END AS IsAdministrator, CASE WHEN dbo.ContactMaster.Role = 6 THEN 1 ELSE 0 END AS IsDecisionMaker, CASE WHEN dbo.ContactMaster.Role = 5 THEN 1 ELSE 0 END AS IsAccountingAP FROM dbo.ContactMaster INNER JOIN dbo.CustomerMaster ON dbo.ContactMaster.CompanyID = dbo.CustomerMaster.CustomerIdentity LEFT OUTER JOIN dbo.AddressList ON dbo.ContactMaster.ContactAddress = dbo.AddressList.AddressIdentity LEFT OUTER JOIN dbo.CityEnumerator ON dbo.AddressList.CustomerCity = dbo.CityEnumerator.CityIdentity LEFT OUTER JOIN dbo.StateEnumerator ON dbo.AddressList.CustomerStateorProvince = dbo.StateEnumerator.StateIdentity WHERE (dbo.CustomerMaster.CustomerStatus = 1) AND (dbo.ContactMaster.Status = 1) ORDER BY dbo.CustomerMaster.BSACustomerKey
  • SQL Query

    database tutorial
    2
    0 Votes
    2 Posts
    0 Views
    M
    Try this: SELECT tableIdentity, case when groupstatus = 1 or groupstatus = 0 then 'In Progress' else 'OK' end GroupDesc from tableOne where tabid = T1; You should also physically confirm that you have only a single row named T1.
  • Tables in database.

    database learning
    3
    0 Votes
    3 Posts
    0 Views
    P
    Do you mean that you want to delete the same information from multiple tables? Humble Programmer
  • 0 Votes
    2 Posts
    0 Views
    L
    developerit wrote: then how to write the querry for this condition please give the example which helps me. You'll need to write a SELECT[^] statement, with a filter on the EndDate. You'd have to compare whether this EndDate equals "today" + 10 days. You can get todays date by using the GETDATE()[^]-function, and add 10 days using the DATEADD[^] function. Good luck :) I are Troll :suss:
  • sql select/grouping question

    question database tutorial
    7
    0 Votes
    7 Posts
    0 Views
    C
    Try a sub query (top 5) that is grouped by title and ordered by number of plays. Let me think about this and hopefully get back to you soon. djj
  • Help with Data Type mismatch in criteria expression

    help database
    12
    0 Votes
    12 Posts
    0 Views
    M
    I use SQL Express with no problem and it does most jobs. I tried to install the developer version but it was not an option with the download I was using so I stuck with Express Never underestimate the power of human stupidity RAH
  • Connect to Remote Server [modified]

    sysadmin database sql-server help
    7
    0 Votes
    7 Posts
    0 Views
    realJSOPR
    This is almost a non-issue, as I have halfway decided to use SqlLite instead. Thanks anyway. :) .45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
  • oracle & .net

    csharp database sql-server oracle sysadmin
    7
    0 Votes
    7 Posts
    0 Views
    A
    thanks that is exactly what i want