|
I am trying to use a SQL Server 2008 Ranking Function on a query sorted by a derived column. Here's an example
SELECT table.FirstName, table.LastName, CalculatedValue(table.number) As Points, ROW_NUMBER() OVER (ORDER BY points) AS 'Row Number' FROM table...
Started by wrburgess on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
How about using a derived table (sub query)? I think something like the following should work.
|
|
Hello,
What the best way to check the column (in DerivedColum component) is NULL. If NULL => log error else continue with data flow.
Regards
Started by Nev_Rahd on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Or you could try flowing into another derived column that uses values in the row to form an output to some log....
Flowing the derived column control into a condional split control elegant though.
This might help you partially.
|
|
Hoping this is trivial for a SQL-Ninja... Been trying to get the following query working:
This is under MSSQL Server 2008
SELECT ROW_NUMBER() OVER (ORDER BY Date_Time DESC) AS RowNumber, * FROM ( SELECT T.A_ID, T.User_Name, T.Date_Time, T.Value, U.ID,...
Started by Nick Veys on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Use a derived table or a CTE:
SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (...) as RowNumber.
You must move the WHERE operator above the project list where RowNumber column is created.
|
Ask your Facebook Friends
|
I have an id column which is a primary key with AUTO_INCREMENT. I need the value that is generated to be inserted into the id column, as well as another column (which isn't set to AUTO_INCREMENT, and isnt unique.
Currently I use the mysqld_isnert_id()...
Started by Yegor on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
That contains the NEXT insert id.
Is generated, but you could try the following, since if it works it'll save you an update (If the column you 'tables', there you access the column auto_increment.
|
|
I have a table with a 'Wav' column that is of type 'VARBINARY(max)' (storing a wav file) and would like to be able to check if there is a wav from Linq to SQL.
My first approach was to do the following in Linq:
var result = from row in dc.Table select...
Started by bounav on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Somewhere else on stackoverflow: http://stackoverflow.com/questions/441869/create-a-computed-column [Wav] Is Null Then (1) Else (0) End)
Now I'll update my DBML to reflect that computed column.
|
|
This code using an OLEDB source will populate the OutputColumnCollection below it, the code using a flatfile source will not populate the OutputColumnCollection.
Why not? Microsoft.SqlServer.Dts.Runtime.Application a = new Microsoft.SqlServer.Dts.Runtime...
Started by Steve Schlichter on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Also you didn't include very much information in your post about what is going wrong... .
Check to make sure its not something simple like this first .
I have had issues using SSIS with flat files for input and sql output because the data types didn't match .
|
|
Is there a way in TSQL to do something like this:
select a,b,c, case when a=1 then 5 when a=2 then 6 end as d from some_table where d=6
The actual case statement is really complex, so I'm trying to avoid repeating it in the where clause? Are there any...
Started by Greg on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Another option is to implement your case.
This is a good place to use CTEs, there's no point in being able to reference a derived column.
There is no way to reference a derived column in the same query.
|
|
Hello,
I have a class that derives from ActiveRecord::Base. This class has a subclass that is differentiated in the database by a type id column. How do I make sure that all the inherited active record functions in the derived classes append the type_...
Started by Mattew on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
That's why what Radar said about your column being.
What you are doing is called Single Table Inheritance (STI) .
If your column was called "type", ActiveRecord would do this automatically for you.
|
|
Hi Is there any way to check Date(like isDate function in TSQL) column in SSIS package derived column expression after extraction from Sourcefile before loading to target dtabase?
Thanks
Started by rmdussa on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
There is a a data conversion task you can drop .
If the column is a date and operate on it as you wish...
|
|
How do you persist a derived attribute which depends on the value of id in rails? The snippet below seems to work-- Is there a better rails way?
class Model < ActiveRecord::Base .... def save super #derived_attr column exists in DB self.derived_attr...
Started by Chandra Patni on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Class Model....
I've made set_virtual_attr public so that it can be calculated as needed .
The before_save call in the following code is functionally equivalent to all the code in the question .
Callbacks are provided so you should never have to override save .
|