Hi,
I have a table, department , with several bit fields to indicate department types
One is Warehouse (when true, indicate the department is warehouse)
And I have another table, ManagersForWarehouses with following structure:
ID autoinc
WarehouseID int (foreign key reference DepartmentID from departments)
ManagerID int (foreign key r...
Table has the following info:
date |vendor|sales|percent|
--------------------------
2009-03-03| 10 |13.50| 1.30 |
2009-03-10| 10 |42.50| 4.25 |
2009-03-03| 21 |23.50| 2.30 |
2009-03-10| 21 |32.50| 3.25 |
2009-03-03| 18 |53.50| 5.30 |
2009-03-10| 18 |44.50| 4.45 |
I want it to sort into separate tables depending on d...
Using the Stack Overflow public data dump, I've created three simple tables:
Questions (Question_Id, View_Count, Creation_Date)
Tags (Tag_Name)
QuestionTags (Question_Id, Tag_Name)
The Questions table has hundreds of thousands of rows with Creation_Date spanning from a year ago to today. Looking over the data, there are two notable t...
A partial fragment of my output looks as follows:
CNEP P000000025 1
CNEP P000000029 1
NONMAT P000000029 1
CNEP P000000030 1
CWHCNP P000000030 1
MSN P000000030 1
Each row represents a term that a student is in a particular curriculum. Right now I am grouping the information to make sure that each UserID correlates to a partcul...
I have a DateTime field in SQL Server for some products expiration (ExpirationDate). I need to increment all the items manually, and set their expiration a month later than the date stored in the field currently. How can I do that?
...
Oh great Stackoverflow, I beseech thee...
I need to do the following:
CREATE UNIQUE INDEX UserName ON Emp(UserName) -- Sheesh!
UPDATE Emp SET
UserName = Left(FirstName,1)+LastName
WHERE NOT exists an employee with that UserName already.
...
How can I correct the following so that I don't receive a syntax error in Microsoft SQL Server 2005?
UPDATE Emp E
SET UserName = Left(FirstName,1)+LastName
WHERE EmpID=1
AND NOT EXISTS(
SELECT * FROM Emp
WHERE UserName=Left(E.FirstName,1)+E.LastName
)
...
I have an Entity-Value set of tables, and would like to pivot the results.
Here's the effect that I'm looking for, except you see that the SELECT stmt using Common Table Expressions isn't working exactly right yet.
My question is: Am I on the right track, or is there some sort of easy pivot command?
USE TempDB
Declare @Person TABLE(
Per...
what are some of the cases that will cause a SQL Server 2005 cursor to deallocate prematurely?
...
I am trying to master a new ERP application. Basically I have good functional knowledge. And I was advised to learn SQL .I do not know where to start. I have two books .Below are the urls which has the TOC of each book. Which book should I read first? The idea is to get a good understanding of the relationship between ERP and database a...
I am currently working on a project where some (significant) data corruption has occurred. Specifically the database is using GUIDs as primary keys on most tables, however it is not enforcing data integrity between those tables (due to a long-winded "this was bought from another company and integrated with our stuff" discussion). There...
I have an application that is ready to go live, once we take data from a MS Access DB and import it into SQL Server 2005. I have used the Migration - Access tool to get the Access db into SQL Server, but now I need to take the data from that table and put it into the tables that our app is going to use. Is there a T-Sql way to Insert m...
I am making a webapp right now and I am trying to get my head around the database design.
I have a user model(username (which is primary key), password, email, website)
I have a entry model(id, title, content, comments, commentCount)
A user can only comment on an entry once. What is the best and most efficient way to go about doing thi...
I have a cross reference table that looks like this:
id document_id subject_id
1 8 21
2 5 17
3 5 76
4 7 88
5 9 17
6 9 76
7 2 76
It matches documents to subjects. Documents can be members of more than one subject. I want to return rows from thi...
Is there a way (in MySQL) to get the pure SQL statement after parameters have been added? I'm having issues with one of my statements once I start using parameters, and I want to see what's being executed. Of course it has to do with dates.
Using MySQL .NET Connector. I have access to MySQL server, and I use SQLYog to administrate.
Tha...
In short I have 2 tables:
USERS:
------------------------
UserID | Name
------------------------
0 a
1 b
2 c
CALLS:
------------------------
ToUser | Result
------------------------
0 ANSWERED
1 ENGAGED
1 ANSWERED
0 ANSWERED
ect ect (i use a numerical referance for result in reality)
I have over ...
I don't know how to form the connection string.
Lets say the server is server.com, with a SQL Instance called MSSQL.1
Looking at a previous example, it looks like the data source would be server.com\MSSQL.1
I installed SQL Express using all the defaults on Windows Server 2003.
Any help is appreciated. Thanks
Kevin
...
(Hi all. I'm new-ish to SQL and MySQL in particular. I know some PHP.)
I have a table which contains a "date_string" column. For legacy reasons, this is a text field, containing the date in d/m/YY format. e.g. "22/11/09" for 22nd November 2009.
Question: how could I convert all fields in this column to a standard MySQL date format (YY...
I run PHP and MySQL on the same machine, but both report different times.
I set the timezones by the following methods:
PHP:
date_default_timezone_set('Asia/Kuala_Lumpur');
MySQL:
SET time_zone = "Asia/Kuala_Lumpur";
The difference between two times is always exactly 24 seconds.
Any idea why this is happening?
I thought the times...
Hi,
I've an event-driven app that has recently started using SQL Express 2008 (instead of Std version) in dev and test to store the current state of a state machine. After moving to SQL Express, we started seeing a discrepancy between the order in which we write to the database (using LINQ to SQL) and the order in which SQL Express Prof...