Forum Replies Created

Viewing 15 posts - 241 through 255 (of 345 total)

  • RE: How to make script of all constraints

    SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE

  • RE: Re-designing a Transaction Database - 37 Types of Transactions

    craigbroadman (5/18/2011)


    ...

    My question is, do I create generic tables, with alot of redundant columns for each type e.g.

    ...

    Or, do I get specific and go a level down and create separate...

  • RE: newbie to sql server

    PaulB-TheOneAndOnly (5/18/2011)


    crainlee2 (5/16/2011)


    I'm especially proud of this one:

    USE Master

    DELETE FROM SYSOBJECTS

    What do you think?

    I think you have a great potential for a stand up comedian career 😀

    I agree. I don't...

  • RE: Select rows from table that don exist in another with where clause

    Stefan, your solution lists the staff members for that particular periodID. It seems to me he wants the staff that are not matched.

  • RE: Select rows from table that don exist in another with where clause

    Working DDL for the adventurers:

    create table tTimetable (DayID int, PeriodID int, StaffID int);

    insert into tTimetable

    values

    (1,1,2),

    (1,1,7),

    (1,1,8),

    (1,1,9),

    (1,2,6),

    (1,2,7),

    (1,2,8),

    (1,2,9),

    (1,3,1),

    (1,3,2),

    (1,3,3),

    (1,3,4),

    (1,3,5),

    (1,3,6),

    (1,3,7)

    create table tStaffTimeTableInfo (StaffID int, StaffInitials varchar(10));

    insert into tStaffTimeTableInfo

    values

    (1,'ABC'),

    (2,'RWT'),

    (3,'YUJ'),

    (4,'OPP'),

    (5,'QWE'),

    (6,'TFV'),

    (7,'ASA'),

    (8,'MNB'),

    (9,'PLM')

    drop table tTimetable;

    drop table tStaffTimeTableInfo;

    EDIT: he...

  • RE: SQL Query

    Mr Quillz (5/16/2011)


    Hi Guys,

    I'm not a big fan of using sub-queries unless it is absolutely necessary to do so.

    This is not a sub-query, it's a derived table and is...

  • RE: Read and execute SQL string from Table, output to file

    Here is something we can work with. Start with a basic table create and some sample data.

    create table SQL_List (Stmt_ID int identity(1,1), SQL_Stmt varchar(8000), File_location varchar(8000));

    insert into SQL_List( SQL_Stmt, File_location)

    select...

  • RE: Read and execute SQL string from Table, output to file

    In step 2, what type of sql statements are you storing in the table?

  • RE: Trouble Declaring a Variable in a Stored Procedure

    I know all about the horrors of inherited code, so I know what you're going through. :w00t:

    It seems like the author was using dynamic sql to conditionally append that last...

  • RE: Trouble Declaring a Variable in a Stored Procedure

    The variables in the dynamic sql run in a different scope than the procedure. But it looks like you are not concatenating your variables into the sql string. When you...

  • RE: Conditional Counting

    Can you post some DDL that works? 😉

  • RE: Conditional Counting

    You can conditionally pick that value with a sub-select:

    SELECT count(B.TRANS_TYPE) STARTS, B.PROD_CODE pcode, B.CODE CScode

    FROM SUBS B

    WHERE B.TRANS_DATE between '1/1/2011' AND '5/1/2011'

    AND (B.TRANS_TYPE = '3'

    OR

    B.TRANS_TYPE =...

  • RE: Identity Crisis: Attack of the Clone

    mtassin (5/11/2011)...

    At that point, just call the bloody thing a primary key.

    So I see INT IDENTITY(1,1) and these days I assume PRIMARY KEY is stuck on the end of it.

    Then...

  • RE: SQL Query

    This will get the bad children for you:

    select s.stud_code, s.given_name, x.Num_Absences

    from Student s

    inner join

    (

    select stud_code, count(*) Num_Absences

    from Student_Absent

    group by stud_code

    having count(*) > 2

    ) x on s.stud_code =...

  • RE: Help with xp_DirTree

    Your code is working perfectly fine for me, Greg. I created a folder in c:\temp called "todd's files" and as long as there is a file in that folder, the...

Viewing 15 posts - 241 through 255 (of 345 total)