Viewing 15 posts - 2,401 through 2,415 (of 2,462 total)
Based on your sample data and DLL this should work:
SELECTFlightDate,
FlightNumber,
ScheduleOrder,
MIN(AircraftNumber) OriginalAircraftNumber,
MAX(AircraftNumber) FinalAircraftNumber,
ChangeOfAircraftIndicator=
CASE
WHEN COUNT(ScheduleOrder)=1 THEN 'N' ELSE 'Y'
END
FROM [dbo].[DailySchedule]
GROUP BY FlightDate, FlightNumber, ScheduleOrder
ORDER BY FlightDate, FlightNumber, ScheduleOrder
This will...
-- Itzik Ben-Gan 2001
August 30, 2012 at 1:29 pm
also, if the stored procs are spread accross multiple databases you could use this:
-- create temp table for result set
IF OBJECT_ID('tempdb..#sprocSearchResults') IS NOT NULL
DROP TABLE #sprocSearchResults
CREATE TABLE #sprocSearchResults (StoredProc...
-- Itzik Ben-Gan 2001
August 30, 2012 at 10:30 am
Someone beet me to it but you can also use:
SELECT DB_NAME()+'.'+ROUTINE_SCHEMA+'.'+ROUTINE_NAME [Stored Proc]
FROM INFORMATION_SCHEMA.ROUTINES
WHERE CHARINDEX('@prmSorted',ROUTINE_DEFINITION)<>0
AND ROUTINE_TYPE='PROCEDURE'
-- Itzik Ben-Gan 2001
August 30, 2012 at 9:17 am
The stairways are great. I also use Microsoft E-Learning; there is ton's of free stuff there.
-- Itzik Ben-Gan 2001
August 21, 2012 at 3:30 pm
Expanding on mohankollu's solution... You can get this returned as text in the result set with
DECLARE @aa table(col varchar(20))
insert into @aa values('100'),('200'),('300'),('400'),('500');
WITH t(col) AS
(
SELECT col+','
FROM @aa FOR...
-- Itzik Ben-Gan 2001
August 21, 2012 at 3:26 pm
ashwinboinala (8/21/2012)
i have an issue Subscriber DB size is growing larger than Publisher , publisher db is 21gb , but subscriber db is 72 gb i am using...
-- Itzik Ben-Gan 2001
August 21, 2012 at 11:38 am
There are many, many ways to procuce each result set. For the first one you could use UNION (not UNION ALL).
-- Itzik Ben-Gan 2001
August 21, 2012 at 11:29 am
Can you post some ddl? how many rows are in these tables? It would be helpful to understand your indexes, contraints, etc.
-- Itzik Ben-Gan 2001
August 21, 2012 at 11:14 am
GilaMonster (8/20/2012)
That query returns the total size of the DB files. A backup does not back up the entire file, just the used portion of...
-- Itzik Ben-Gan 2001
August 20, 2012 at 6:00 pm
This will tell you the minimum size (the size of your MDF and NDF files). The backup, unless compressed, will never be less than this.
USE {myDB};
SELECT SUM(size/128) AS mb...
-- Itzik Ben-Gan 2001
August 20, 2012 at 4:03 pm
Transaction log maintenance can be a drag. The stairway about this topic is great.
-- Itzik Ben-Gan 2001
August 20, 2012 at 3:48 pm
Beginner2012 (6/8/2012)
Hello,can we create a SQL server table on a PC based on a query on the sql server ?
Thank you
edited... Misunderstood your question.
... Perhaps some more detail would...
-- Itzik Ben-Gan 2001
August 16, 2012 at 6:27 pm
TRY/CATCH is traditionally used more for stuff like this:
SET NOCOUNT ON;
DECLARE @pos TABLE (sale_id varchar(4), product_id int)
DECLARE @err varchar(200)
BEGIN TRY
INSERT INTO @pos VALUES ('ccc', 'a')
END TRY
BEGIN CATCH
--...
-- Itzik Ben-Gan 2001
August 16, 2012 at 3:23 pm
Read, read, read: books online, a web page or blog...
Practice, practice, practice...
Microsoft E-learning, plenty of free stuff there. Go to products > SQL Server. There's tons of free...
-- Itzik Ben-Gan 2001
August 16, 2012 at 2:26 pm
First, being a DBA and a SQL developer is an excellent experience on bothaccounts. This is also a great time as there is a HUGE shortage of DBAs and Database...
-- Itzik Ben-Gan 2001
August 7, 2012 at 12:16 am
Viewing 15 posts - 2,401 through 2,415 (of 2,462 total)