Viewing 15 posts - 721 through 735 (of 897 total)
You can make use of a Derived Table like below
SELECTNetQty, NetPrice = NetQty * Rate
FROM(
SELECT NetQty = ( sellQty - BuyQty )
FROM ...
June 25, 2010 at 1:38 am
This will give you the result you need, but i think the typing effort will be the same if not more because here there is a PARTITION BY clause which...
June 25, 2010 at 1:30 am
You can also use the ROW_NUMBER() function, but here again you will have a PARTITION BY clause which is similar to the GROUP BY Clause.
If you need more detailed help,...
June 24, 2010 at 11:46 pm
sachinrshetty (6/24/2010)
Thank u Raunak. Perfect Answer 🙂
You interviewer is not going to say the same to you as Thank you Sachin. Perfect Answer. Be prepared for more detailed questions on...
June 24, 2010 at 2:01 am
This might help you
; WITH cte_TableName AS
(
SELECTROW_NUMBER() OVER( PARTITION BY index_code, code1, code2 ORDER BY startdate ) Row, *
FROMTableName
)
SELECTT1.index_code, T1.code1, T1.code2, T1.startdate, DATEADD( DAY, -1, T2.startdate ) enddate
FROMcte_TableName T1
LEFT JOIN...
June 24, 2010 at 1:15 am
Try this one
DECLARE @Notes varchar(MAX)
-- Here you are assigning a value to a variable
SELECT @Notes = COALESCE(@Notes + ':', '') +
CAST(Memo AS varchar(max))+'...
June 16, 2010 at 6:51 am
pattamuthu (6/16/2010)
June 16, 2010 at 6:12 am
You can do this using a LEFT OUTER JOIN
SELECTA.*, 'True' Status
FROM[Account] A
LEFT OUTER JOIN[Transaction] T ON A.msisdn = T.msisdn
WHERET.msisdn IS NULL
June 16, 2010 at 4:25 am
Can you provide the query that gives you the error A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
Probably you are doing...
June 15, 2010 at 11:50 pm
sharath.chalamgari (6/14/2010)
for a second i thought Question as How many Rows then while selecting the answer i saw it as columns ...
June 14, 2010 at 12:48 am
I cant see any scalar value getting inserted or am i missing something
June 14, 2010 at 12:28 am
Well, thats a bit of a problem. I have no idea of how to solve this. Hopefully somebody will come up with a solution soon.
As for the problem in your...
June 11, 2010 at 5:41 am
I am not sure but i think DBCC CHECKIDENT( 'TableName' ) always gives the same value for current column value and current identity value.
It changes only when you reseed it...
June 11, 2010 at 5:32 am
You could do it in this way then
INSERTSomeTableName( TableName, IdentityValue )
SELECTname, ident_current( name )
FROMsys.objects
WHEREOBJECTPROPERTY( OBJECT_ID( name ),'TableHasIdentity' ) = 1
ANDTYPE = 'U'
June 11, 2010 at 5:11 am
Viewing 15 posts - 721 through 735 (of 897 total)