Hi,
I have noticed that if I have a unique compound keys for two columns, column_a and column_b, then my sql ignores this constraint if one column is null.
E.g.
if column_a=1 and column_b = null I can insert column_a=1 and column_b=null as much as I like
if column_a=1 and column_b = 2 I can only insert this value once.
Is there a...
I have a table (MySQL) that captures samples every n seconds. The table has many columns, but all that matters for this is two: a time stamp (of type TIMESTAMP) and a count (of type INT).
What I would like to do, is get sums and averages of the count column over a range of times. For instance, I have samples every 2 seconds recorded...
I would like to add a way to see if an entry is already in a connected database in the following code and if it is, not to add the entry and pop up a dialog saying something to the effect of "already been scanned" and if it is not to proceed as usual. a simple if statement should do.
Using connection As New SqlClient.SqlConn...
Hello all,
I'm currently tasked with reading some data that stored in a flat file into my database and run reports against it. The one problem I'm running into is checking to see if a file actually exists. Is there a simple function to check if the file exists?
Thanks!
...
Did Microsoft remove the graphical table designer from SQL Server 2008 R2? I'm using it to connect to SQL Azure and I'm not getting the nice graphical designer from 2005. I was wondering if this is a SSMS R2 thing or an Azure thing.
Thanks!
...
I have two tables, Tasks and TaskMilestones. I want a query to return the most recent past milestone and the nearest future TaskMilestone for each Task. I'm working with C#/LINQ-to-SQL. How do I go about this?
Task columns: Id, TaskName
TaskMilestones columns: Id, TaskId, MilestoneName, MilestoneDate
I want a return table with rows...
Hi!
This is more or less a best-practice question:
I'm working on a site that requires me to relate some tables to several different tables.
For instance, I have a Comments-table, that I would like to relate in a way such as one might comment on entities in Table A, but also in Table B separately.
Similarly, I have a rating-table that...
Tell me please what's the best way to copy db structure to another server?
I'm trying to generate a script in Management Studio and then run that script on the remote machine. And I hate that thing. It works unpredictable, you have to fix manually a lot of crap in the generated script. I guess that isn't the best solution.
Then I tried...
Hi, database/SQL novice here.
I have a table with a column called, for example, "EmployeeID". I want a query that will, for each distinct employeeID, return the number of rows that have that as their ID. I hope it's clear what I'm trying to do and someone will know how to help!
I don't think it should matter, but just in case, I'm usin...
I am trying to add the NETWORK SERVICE login cause I still can’t connect to the AdventureWorks3 database. But I want to add this NETWORK SERVICE login via SQL Server Authentication and not Windows.
When I select Windows authentication, it lets me create this login. But when I select SQL Server Auth, it gives me the following error: Crea...
Could someone please define what is meant by a schema provider? I'm familiar with DB schema (in this context, I take them to mean a named, logical container for DB objects). Why would a schema provider be useful? From a high level, how do they operate?
The context here is SQL Server 2008.
...
I need to give a new login read access to all 300 databases on a server. How can I accomplish this without checking 300 checkboxes in the user mapping area?
...
How can I return two columns that each use different WHERE critia? Obviously, this won't work:
SELECT Name, COUNT(Column1) AS Total, COUNT(Column1) AS YearToDate
FROM Table1
WHERE Occurred_Date BETWEEN '2010-06-01' AND '2010-06-30' --Total
WHERE Occurred_Date BETWEEN '2010-01-01' AND '2010-06-30' --YearToDate
This is the output I'm lo...
Hi,
I have a (seems to be) very easy problem, but after searching for hours, I can't find anything helpful.
Here's the problem:
In Microsoft SQL, I have a table where a column A stores some data. This data can contain duplicates (ie. two or more rows will have the same value for the column A).
I can easily find the duplicates by doin...
I want to use a list of arbitrary numbers as a sort of input to a select. Option A, of course, is to create a temporary table that contains just the values (e.g., 1,2,3).
I hope that you folks know what Option >A is.
Suppose the statement is like:
select Fx,
XXXXXX as Foo
from MyTable
where MyTest depends on each XXXXXX
So if I cou...
i want to search all teh fields in my DB to find the field names that have in them a string that contains some text.
im trying to find a table and field responsible for some 3rd party software actions that i am aonly able to see the values for. i want to use these values to find the table and field they are stored in.
...
What difference between Super and Candidate key in ERDB?
Thanks.
...
Possible Duplicate:
How do I Create a Comma-Separated List using a SQL Query?
ItemName | DepartmentId
---------------------
Item1 | 21
Item1 | 13
Item1 | 9
Item1 | 36
Item2 | 4
Item2 | 9
Item2 | 44
I need to display all the department Id's that require a particular Item using SQL Querie...
I am having trouble running a simple sql query in Microsoft SQL Server 2005 to create a database and im not sure why.
When I run this query
CREATE DATABASE 4444-virtual2
I receive this error
Incorrect syntax near '4444'.
Is there anything in particular that I must specify if I am creating a database table with numeric values in...
How can I create a File Group on a different drive with MSSQL 2005 and then move a table into it?
Ex)
My Database is on H:\Product.mdf and H:\Product.ldf
I want to create a new file group on F:\FileGroup\ and then move my table with a clustered index to this new file group.
Thanks
...