Click here to Skip to main content
15,916,379 members
Home / Discussions / Database
   

Database

 
QuestionUpdate query does not affects matched Pin
Abdul-Rhman Alsri21-Oct-10 5:28
Abdul-Rhman Alsri21-Oct-10 5:28 
AnswerRe: Update query does not affects matched Pin
Eddy Vluggen21-Oct-10 10:02
professionalEddy Vluggen21-Oct-10 10:02 
QuestionStored Procedure Pin
Nath20-Oct-10 22:19
Nath20-Oct-10 22:19 
AnswerRe: Stored Procedure Pin
J4amieC20-Oct-10 23:38
J4amieC20-Oct-10 23:38 
GeneralRe: Stored Procedure Pin
Mycroft Holmes21-Oct-10 13:04
professionalMycroft Holmes21-Oct-10 13:04 
GeneralRe: Stored Procedure Pin
J4amieC21-Oct-10 21:48
J4amieC21-Oct-10 21:48 
GeneralRe: Stored Procedure Pin
Mycroft Holmes22-Oct-10 0:52
professionalMycroft Holmes22-Oct-10 0:52 
QuestionReturn name and identity for all tables Pin
yippiecoder20-Oct-10 10:55
yippiecoder20-Oct-10 10:55 
Little help with returning both the name and the current identity for all tables? If a table doesn't have any rows, instead of the current identity, I'd like to return 0. The database will be in single user mode during the query if that helps.

The following query is close but it still returns 1 for tables that don't have any rows. Somehow the CASE expression isn't right.

Thanks in advance.

SELECT 
    TABLE_NAME,
    CASE 
        WHEN COUNT(TABLE_NAME) = 0 THEN 
            0
        ELSE
            IDENT_CURRENT(TABLE_NAME) 
    END
FROM
    INFORMATION_SCHEMA.TABLES
WHERE
        OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'TableHasIdentity') = 1
    AND 
        TABLE_TYPE = 'BASE TABLE'
GROUP BY 
    TABLE_NAME

AnswerRe: Return name and identity for all tables Pin
Blue_Boy20-Oct-10 21:12
Blue_Boy20-Oct-10 21:12 
GeneralRe: Return name and identity for all tables Pin
David Skelly20-Oct-10 22:40
David Skelly20-Oct-10 22:40 
QuestionI want your help Pin
Lamis Radman19-Oct-10 9:31
Lamis Radman19-Oct-10 9:31 
AnswerRe: I want your help Pin
Pete O'Hanlon20-Oct-10 0:02
mvePete O'Hanlon20-Oct-10 0:02 
QuestionXml datatype vs cdc Pin
Ebube19-Oct-10 6:47
Ebube19-Oct-10 6:47 
AnswerRe: Xml datatype vs cdc Pin
Mycroft Holmes19-Oct-10 12:22
professionalMycroft Holmes19-Oct-10 12:22 
GeneralRe: Xml datatype vs cdc Pin
Ebube21-Oct-10 5:37
Ebube21-Oct-10 5:37 
Questionhow to use % symbol in Like statement. Pin
shiva.kore18-Oct-10 21:13
shiva.kore18-Oct-10 21:13 
AnswerRe: how to use % symbol in Like statement. Pin
thatraja18-Oct-10 21:21
professionalthatraja18-Oct-10 21:21 
QuestionMessage Removed Pin
18-Oct-10 8:03
eddieangel18-Oct-10 8:03 
AnswerRe: Normalization / Referential Integrity Pin
Eddy Vluggen18-Oct-10 8:21
professionalEddy Vluggen18-Oct-10 8:21 
AnswerRe: Normalization / Referential Integrity Pin
Chris Meech18-Oct-10 8:43
Chris Meech18-Oct-10 8:43 
AnswerRe: Normalization / Referential Integrity [modified] Pin
PIEBALDconsult18-Oct-10 9:00
mvePIEBALDconsult18-Oct-10 9:00 
AnswerRe: Normalization / Referential Integrity Pin
Mycroft Holmes18-Oct-10 13:00
professionalMycroft Holmes18-Oct-10 13:00 
GeneralRe: Normalization / Referential Integrity Pin
eddieangel18-Oct-10 13:12
eddieangel18-Oct-10 13:12 
AnswerRe: Normalization / Referential Integrity Pin
Ray Cassick18-Oct-10 13:51
Ray Cassick18-Oct-10 13:51 
QuestionCan a Unique Index be set on a secondary linked table field? Pin
Stryder_118-Oct-10 7:29
Stryder_118-Oct-10 7:29 

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.