Click here to Skip to main content
15,897,518 members
Home / Discussions / Database
   

Database

 
AnswerRe: Taking Database backup for every 4 hrs in SSIS Pin
Simon_Whale29-Dec-10 3:16
Simon_Whale29-Dec-10 3:16 
QuestionQuery at database level Pin
vanikanc28-Dec-10 8:03
vanikanc28-Dec-10 8:03 
AnswerRe: Query at database level Pin
Hiren solanki28-Dec-10 19:23
Hiren solanki28-Dec-10 19:23 
GeneralRe: Query at database level Pin
vanikanc29-Dec-10 2:35
vanikanc29-Dec-10 2:35 
AnswerRe: Query at database level Pin
Hiren solanki29-Dec-10 2:44
Hiren solanki29-Dec-10 2:44 
GeneralRe: Query at database level Pin
jschell29-Dec-10 5:37
jschell29-Dec-10 5:37 
GeneralRe: Query at database level Pin
Hiren solanki29-Dec-10 19:18
Hiren solanki29-Dec-10 19:18 
AnswerRe: Query at database level Pin
Terry Reardon30-Dec-10 7:00
Terry Reardon30-Dec-10 7:00 
Hi,
try something like this and build on a sql string, I hope this helps.

DECLARE @sql VARCHAR(MAX), @db VARCHAR(255)

DECLARE c CURSOR FOR 
   SELECT [name] from master.dbo.sysdatabases 
OPEN c 
FETCH NEXT FROM c INTO @db
WHILE @@FETCH_STATUS = 0
BEGIN

SET @sql = 'Use ' + @db + SPACE(2)
SET @sql = @sql  + ' SELECT t.name As TableName, i.name As IndexName FROM sys.tables t, 
                     sys.indexes i 
					 WHERE i.object_id = t.object_id
					 ORDER BY t.Name' 

FETCH NEXT FROM c INTO @db END

CLOSE c
DEALLOCATE c

--PRINT @SQL

EXEC(@sql)

TJR
We Came! We Saw! We Listened! We Eliminated Ambiguity and developed a system the user wanted, not what we thought they wanted.
Enough Said!

AnswerRe: Query at database level Pin
Henry Minute29-Dec-10 4:24
Henry Minute29-Dec-10 4:24 
AnswerRe: Query at database level [modified] Pin
senthil raja . j29-Dec-10 17:40
senthil raja . j29-Dec-10 17:40 
GeneralRe: Query at database level Pin
Hiren solanki29-Dec-10 18:56
Hiren solanki29-Dec-10 18:56 
Questionbackup database not working Pin
MrBatra28-Dec-10 4:24
MrBatra28-Dec-10 4:24 
AnswerRe: backup database not working Pin
thatraja28-Dec-10 18:36
professionalthatraja28-Dec-10 18:36 
GeneralRe: backup database not working Pin
MrBatra29-Dec-10 3:42
MrBatra29-Dec-10 3:42 
AnswerRe: backup database not working Pin
Hiren solanki28-Dec-10 18:41
Hiren solanki28-Dec-10 18:41 
GeneralRe: backup database not working Pin
MrBatra29-Dec-10 3:43
MrBatra29-Dec-10 3:43 
QuestionTables records deleted !!! Pin
devboycpp28-Dec-10 3:39
devboycpp28-Dec-10 3:39 
QuestionRe: Tables records deleted !!! Pin
badprog28-Dec-10 4:06
badprog28-Dec-10 4:06 
AnswerRe: Tables records deleted !!! Pin
devboycpp28-Dec-10 4:39
devboycpp28-Dec-10 4:39 
GeneralRe: Tables records deleted !!! Pin
MrBatra28-Dec-10 4:48
MrBatra28-Dec-10 4:48 
AnswerRe: Tables records deleted !!! Pin
badprog28-Dec-10 6:44
badprog28-Dec-10 6:44 
AnswerRe: Tables records deleted !!! Pin
Simon_Whale29-Dec-10 3:23
Simon_Whale29-Dec-10 3:23 
Questionproblems Pin
pancakeleh27-Dec-10 18:00
pancakeleh27-Dec-10 18:00 
AnswerRe: problems Pin
RaviRanjanKr27-Dec-10 18:22
professionalRaviRanjanKr27-Dec-10 18:22 
AnswerCrosspost Pin
thatraja27-Dec-10 18:47
professionalthatraja27-Dec-10 18:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.