Viewing 15 posts - 1,561 through 1,575 (of 1,923 total)
If you want it that way, then you will have to loose the INT data-type and your string will be of VARCHAR..
May 12, 2010 at 8:00 am
Exactly.. use PIVOT with some aggregate functions, then u can transpose rows to columns! There is also another old method, which is bit faster than PIVOT for larger data sets!...
May 12, 2010 at 7:54 am
malavika.ramanathan (5/12/2010)
thanks for your reply. i dont think it works practically as there are many possible durations...or even if we think of 5 min duration the least, i will have...
May 12, 2010 at 6:35 am
Malaivaka, tel us if the following code helps you
SELECT CASE DURATION
WHEN '60' THEN '01:00'
...
May 12, 2010 at 6:12 am
Ankur, there are many methods of grouping data , based on the way we want our output to be!
I recommend you go through the following article:
May 12, 2010 at 5:07 am
Hey there, you can use on of the following
SELECT
EP.EMPLOYEE_ID,
EP.FIRST_NAME + ' ' + ISNULL(EP.MIDDLE_NAME, ' ') + ' ' + ISNULL(EP.LAST_NAME, ' ') AS FULL_NAME,
MB.BUSINESSUNIT_NAME,
CONVERT(VARCHAR(10), EP.DATE_OF_BIRTH, 101) AS DATE_OF_BIRTH,...
May 12, 2010 at 4:36 am
For another server, you can use
SELECT * FROM <Your_Server_Name>.<Your_Database_Name>.sys.identity_columns
provided you have the 2 servers linked using Linker Servers!
Or you can use OPENROWSET or OPENDATASOURCE to access data on another...
May 12, 2010 at 2:29 am
Hi friend!
Here is a code that might do what you wished!
;WITH DATE_CTE AS
(
SELECT DISTINCT DATEPART(MM,from_date) [MONTH] FROM #sample_data
)
SELECT SD.facility , DC.[MONTH], COUNT(*) ...
May 12, 2010 at 2:01 am
If you wish to see the column names, then use the sys.identity_columns catalog view
Sample SQL code for this:
SELECT * FROM sys.identity_columns
To read more about this, click here :- sys.identity_columns!
Hope this...
May 11, 2010 at 11:55 pm
You can use IDENT_INCR and IDENT_SEED functions to get the seed and increment of a table/view.
For more on them, click on them!
Hope this helps you!
Cheers!
May 11, 2010 at 11:49 pm
I dint understand your Expected result.. can u pls elaborate??
I see that
1. For the first month, you are finding the count of distinct facility - which gives '01'...
May 11, 2010 at 11:40 pm
Now that you have posted the sample data and table structure, half the job is prettily done 🙂 Now can you give us some visual representation of how your expected...
May 11, 2010 at 8:40 pm
hmmm.. yes.. lets wait for FilMar to march on! 😀
May 11, 2010 at 6:39 am
Gianluca Sartori (5/11/2010)
ColdCoffee (5/11/2010)
Wow, Gianluca.. cool code.. 😎Thanks, but we still don't know if this is what the OP is after.
Could turn out to be cool... garbage! 😛
:-P. Gian, i...
May 11, 2010 at 6:28 am
Viewing 15 posts - 1,561 through 1,575 (of 1,923 total)