i want to modify my table in sql express edition.. after the modification, i also have chnged my primary key.. but when saving the modified table, it gives error that :
RegistrationForm' table
- Unable to modify table.
Cannot insert the value NULL into column 'ID', table 'StudentRegistration.dbo.Tmp_RegistrationForm'; column does not al...
This is a theoretical question, I was wondering if there is a good way of finding out which condition in the WHERE statements matched.
Say I have a query like this:
SELECT * FROM table WHERE
COND1 OR
(COND2 AND COND3) OR
COND4
Is there any way of knowing which of the conditions made a given row match (or unmatch)?
One ...
This is the scenario. A customer(Customer table) is linked to an account(Account table). And within each account there are multiple items(Items table).
I need to show a report like below.
What is the best way to achieve this?
I have done the customer account table part since that is just a simple report.
How do I nest the table wi...
Here is my query:
PARAMETERS ...
TRANSFORM ...
SELECT ...
...
PIVOT Mytable.type In ("Other","Info");
This is a cross query and I need to set all the column headings with this row: PIVOT Mytable.type In ("Other","Info") and now I have hard-coded the headings, Other and Info.
But I want to do this dynamically. So what I want to do is ...
I need to exclude first id entry, and display the rest on my wordpress, I have never used sql before.
$all_users_id = $wpdb->get_col( $wpdb->prepare("SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC", $sort ));
...
I've got an SQL query that pieces together historic price information. It's not particularly clean and could probably be optimized a great deal. One reason for this is that I use a subquery to grab the 'previous' price value via a subquery and assign it to the alias 'last_value'. Ideally, I'd like to be able to use this alias in the quer...
There was an error parsing the query. [ Token line number = 1,Token line offset = 15,Token in error = User ]
how do i fix this?
im querying it "SELECT * FROM User", and then i get my error, the code im using is this:
public static List<User> GetUsers()
{
List<User> users = new List<User>();
...
Hey!
I am trying to attach a .mdf file in an asp.net 3.5 project to MS SQL Server 2008, so I will be able to open the database and edit it. I have tried to go to server management studio -> connect to server instance -> right-clicked databases and pressed attach -> press add in the "attach database" section. An explorer pops up but it is...
Hello I made a SQL test and dubious/curious about one question:
In which sequence are queries and sub-queries executed by the SQL engine?
the answers was
primary query -> sub query -> sub sub query and so on
sub sub query -> sub query -> prime query
the whole query is interpreted at one time
There is no fixed sequence of interpretati...
what is wrong with this sql query. i cant figure it out.
$query = "SELECT *
FROM tagPairs
WHERE (tag1Id IN ($tag1Id, $tag2Id))
AND (tag2Id IN ($tag1Id, $tag2Id))";
error code:
Couldn't execute query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syn...
I am trying to query a database (SQLServer) with multiple tables of identical structure and with related names i.e.
[TABLE 01 $TRANSACTIONS]
[TABLE 02 $TRANSACTIONS]
...
[TABLE (n) $TRANSACTIONS]
I have a query returning the desired records on one table at a time and can manually select multiple tables with
SELECT {QUERY01} FROM [TAB...
Not sure if this is possible, but there might be a creative approach...
Given this data in SQL Server 2005:
AAA
AAA
BBB
BBB
CCC
CCC
DDD
DDD
How could I return a result set sorted in a pattern like this:
AAA
BBB
CCC
DDD
AAA
BBB
CCC
DDD
...
For a table such as:
create table foo (id int identity primary key)
I would like to query the system tables to determine that id is in fact an IDENTITY column.
The closest thing I found was:
select tc.max_identity from systabcol tc
join systab t on t.table_id = tc.table_id
where t.table_name = 'foo'
Unfortunately max_identity is 0...
i want to use SQL Server 2005 Express edition as database for my "thesis" but i have a bit of problem configuring it. I've installed SQL Server 2005 Express edition, SQL 2005 Service Pack 3(sp3) and the Sql Server Management Studio Express.
I opened up the Sql Server 2005 Surface Area configurations, clicked on Surface are Configuratio...
I have a doubt regarding a database design, suppose a finance/stock software
in the software, the user will be able to create orders,
those orders may contain company products or third-party products
typical product table:
PRIMARY KEY INT productId
KEY INT productcatId
KEY INT supplierId
VARCHAR(20) name
TEXT description
...
but...
Hello,
I have the following tables:
PROJECTS - project_id, name
EMPLOYEES - employee_id, name
SALARY - employee_id, date, per_hour
HOURS - log_id, project_id, employee_id, date, num_hours
I need to query how much a project is costing. Problem is that Salary can vary. For example, a person can get a raise.
The SALARY table logs the...
I have an application that executes the following MySQL query:
SELECT 402 AS user_id,
p.id AS perm_id,
p.name AS perm_name,
lc.business_division_id,
bd.name AS bd_name,
bd.current_cycle, bd.current_moon,
lc.name AS cycle_name,
...
I'm learning SQL at the moment and I've read that joins and subqueries can potentially be performance destroyers. I (somewhat) know the theory about algorithmic complexity in procedural programming languages and try to be mindful of that when programming, but I don't know how expensive different SQL queries can be. I'm deciding whether I...
I want to input data into a sqlite database so that core data can read from the file but I was wandering if there's a way of populating the sqlite data via xcode or do I have to spend lots of money on an sql manager of some kind like RazorSQL to do it?
Thanx...
...
I created a trigger as below:
CREATE OR REPLACE TRIGGER trigger_test
AFTER INSERT ON trigger_1
FOR EACH ROW
DECLARE
t_identifier VARCHAR2(10);
t_name VARCHAR2(20);
BEGIN
t_identifier := (:NEW.IDENTIFIER);
t_name := (:NEW.NAME);
INSERT INTO trigger_2(IDENTIFIER,NAME)VALUES(t_identifier,t_name);
COMMIT;
END;
I am trying to insert a row ...