tables (3,386)


c# - How do I most elegantly express left join with aggregate SQL as LINQ query

c# - How do I most elegantly express left join with aggregate SQL as LINQ query

SQL: SELECT u.id, u.name, isnull(MAX(h.dateCol), '1900-01-01') dateColWithDefault FROM universe u LEFT JOIN history h ON u.id=h.id AND h.dateCol<GETDATE()-1 GROUP BY u.Id, u.name…


sql - What is the best way to handle multiple permission types?

I often encounter the following scenario where I need to offer many different types of permissions. I primarily use ASP.NET/VB.NET with SQL Server 2000. Scenario I want to offer a dynamic permissio…


sql - Drop all tables whose names begin with a certain string

How can I drop all tables whose names begin with a given string? I think this can be done with some dynamic SQL and the INFORMATION_SCHEMA tables.…


sql server - Tables with no Primary Key

I have several tables whose only unique data is a uniqueidentifier(a Guid) column. Because guids are non-sequential(and they're client-side generated so I can't use newsequentialid()), I have made a…


Multiple foreign keys?

I've got a table that is supposed to track days and costs for shipping product from one vendor to another. We(brilliantly:p) stored both the shipping vendors(FedEx, UPS) with the product handling…


sql - Good Resources for Relational Database Design

I'm looking for a book/site/tutorial on best practices for relational database design, tuning for performance etc. It turns out this kind of resource is a bit difficult to find; there's a lot of "her…


sql server - How do you keep two related, but separate, systems in sync with each other?

My current development project has two aspects to it. First, there is a public website where external users can submit and update information for various purposes. This information is then saved to a…


How do I generate scripts that will rebuild my MS SQL Server 2005 database with data?

I have a SQL Server 2005 database, that I would like to be able to recreate at a moment's notice. I want to be able to point to my database and generate a complete set of scripts that will not only c…


SQL Server 2005-Export table programmatically(run a.sql file to rebuild it)

I have a database with a table Customers that have some data I have another database in the office that everything is the same, but my table Customers is empty How can I create a sql file in SQL Serve…



python - updating an auto_now DateTimeField in a parent model w/ Django

I've got two models: Message and Attachment. Each attachment is attached to a specific message, using a ForeignKey on the Attachment model. Both models have an auto_now DateTimeField called updated.…




table sql multiple how from join query with database mysql