I have 2 tables. (table1, table2)
Now, I would like to do something along the lines of:
ALTER TABLE table1 ADD counter INT DEFAULT (Select COUNT(table2.car_type) FROM table2 WHERE (table1.car_type = table2.car_type));
That's the closest syntax I can come up with, but just by looking at it I kn...
@200_success It would certainly be on topic on SO. Advanced SQL problems are officially on topic here too, but that one doesn't seem to require advanced skills. But then, I'm not an Oracle person, don't really know Oracle's capabilities well enough.
Alright what you want to do is ge yourself a Calendar Table these are incredibly useful and every database should have one. On the off chance that that link goes down here is the script included.
/** Create Date Dimension Table **/
/* Create First numbers table for key generation */
So glad he's doing that instead of that stupid union.
I am able to connect to a SQL Server 2012 instance using (Oracle) SQL developer.
I a trying to create some dynamic SQL to query the database.
However, when I run the SQL statement:
DECLARE @SQLquery as NVARCHAR(MAX) = ''
then I get the following error message:
Error starting at line : 2 ...
I have been working on an SSIS solution which would handle the early arriving facts into a dimension with no luck so far. Supposedly, table Loyalty Scheme is related to Partition table and Company table. In the transaction, loyalty scheme ID is NULL with Partition 1 and Company 1 then i'd have to...
The following tables were created in SQL server, and the corresponding values were inserted.
CREATE TABLE Client
(ClientID VARCHAR(4) PRIMARY KEY NOT NULL CHECK (ClientID LIKE 'C%'),
FirstName VARCHAR (15) NOT NULL,
LastName VARCHAR (15) NOT NULL,
DateOfRegistration DATE NOT NULL,
Please think about it, read the man page if necessary, and ask if you still have a specific question afterwards. — Ed Morton12 mins ago
Not having an explanation is exactly giving a man a fish. In this example your code snippet is the fish. You gave it to him. Hence your answer was flagged. As previously stated I declined the flag and suggested you elaborate. If you don't want to elaborate fine I don't care it's just a suggestion to improve your answer. — Zane20 secs ago
I don't think he understands how that metaphor works.
I think they were confused about why their trigger didn't get run
But you're getting this error because the trigger never gets to process. It doesn't get to process because your statement is violating a FK constraint, which is checked BEFORE trigger execution. Your triggers are for AFTERUPDATE which means the update has to process. — JNK1 min ago
Below is the actual table
In the table above:
1) FEID is the examination ID which remains same for one exam, like ist semester examination of particular class. So it will remain same for all rows in above table as it consists of data of single exam always.
2) To store result of single stude...
I have a students tables & scores, classes
I want to delete all data related to students who finished their studies before 2012 - so from the students table its delete from students where graduate year < 2012 but how do i remove all the records from the scores table? I can do a select to all id'...
@swasheck You know. I think the difference between us and people like that is we are aware that we don't know everything about SQL Server and constantly look to learn more. Instead of just getting an idea in your head and running with it forever.
That play to save that empty net goal was amazing.
I have column of name username which have record of usernames and every user name is repeating more than one is there any query or something like trough which i can display every user name maximum one time
Typically, I recommend against using join hints for all the standard reasons. Recently, however, I have found a pattern where I almost always find a forced loop join to perform better. In fact, I am beginning to use and recommend it so much that I wanted to get a second opinion to make sure I a...