Forum Replies Created

Viewing 15 posts - 46 through 60 (of 95 total)

  • RE: Identity inserts - how to reset seed after insert?

    Never used this..but check BOL on this..

    DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)

    HTH

  • RE: Unable to Create Foreign Key

    "I also checked the records in Tbl_Accounts - there are a few records with a null value in Basecurrency but all other records have a matching record in Tbl_Currencies."

    Why do...

  • RE: T-SQL #TempTable headace

    Something like this...

    create table #Temp

    (

    Field1 some_date_type,

    Field2 some_date_type,

    Field3 some_date_type,

    )

    If [Condition1]

    insert #temp( Field1,Field2, Field3)

    Select Field1,Field2, Field3

    from Table

    order by Field3,Field2, Field1

    Else

    If [Condition2]

    insert #temp( Field1,Field2, Field3)

    Select Field1,Field2, Field3

    from Table

    order by Field3,Field2, Field1

    Else

    insert #temp( Field1,Field2,...

  • RE: assitance with aggregates

    Pivoting the table works as Matthew mentions...but I'd probably do it something as follows..

    declare @possible_answers table

    (

    possible_answer char(1)

    )

    declare @questions table

    (

    question char(1)

    )

    declare @results table

    (

    question char(1),

    answer char(1),

    tally int default 0

    )

    insert @questions

    select question

    from...

  • RE: Problem exporting SQL Data to a text file

    Create a DTS package..and create a batch file with a dtsrun acommand. Have the user run the batch file as needed.

    HTH

  • RE: Select and ID Column

    If I'm understanding you...

    select Distinct [ID],CustomerName,CustomerNumber,SalesmanName,Min(ItemDescription) AS ItemDescription,OrigionalDateofService,InsuranceCarrier, Diag1,Diag2,Diag3,Diag4 from O2

    Group By

    [ID],

    CustomerName,

    CustomerNumber,

    SalesmanName,

    OrigionalDateofService,

    InsuranceCarrier,

    Diag1,

    Diag2,

    Diag3,

    Diag4

    By the way if {id] is trully an identity column ..you shouldn't need distinct at all.

    HTH

  • RE: Select and ID Column

    Well one thing is you'd have to determine what "id" you want to return. Do you just return one of them for each distinct set you have or ..do...

  • RE: How To !! - Master Detail Query returning flat result set

    Still not sure exactly what you need.  What is your DDL, and what is an example result you are expecting ?

  • RE: Top N Values and remaining total as one summery row

    I'd do it like this...

     

    declare @table table

    (

    [id] int primary key identity(1,1),

    value float

    )

    declare @results table

    (

     [id] varchar(50) primary key,

     value float 

    )

    declare @low int,

     @high int

    set @low = 0

    set @high = 1000

    while @low <= @high

    begin

     insert...

  • RE: Trying to do a cumulative total based on year/month

    Your DDL would be helpful.

  • RE: SQL Query

    something like this...

    insert results_table(User_id,LessonId,Num_Abset)

    select user_id,lesson_id,count(*) Num_absent

    from SomeTable T

    where t.status = 'Absent'

    group by t.user_id,t.lesson_id

    having count(*) = 5

  • RE: How To !! - Master Detail Query returning flat result set

    If I'm understanding you correctly..a simple join..

    Select M.*,D.*

    from MasterTable M

    join DetailTable D

    on M.ID = D.ID

    HTH

  • RE: Tablename prefix not used

    try ..

    SELECT TOP 10

    S.id_solicitud,

    CONVERT(NCHAR(10), S.fecha_creacion, 120) AS fecha_creacion,

    S.nombre,

    S.clave_material,

    IsNull(CONVERT(NCHAR(10), S.fecha_ini_pruebas, 120), 'N/A') AS fecha_ini_pruebas,

    IsNull(CONVERT(NCHAR(10), S.fecha_fin_pruebas, 120), 'N/A') AS fecha_fin_pruebas,

    IsNull(CONVERT(NCHAR(10), S.fecha_emision_reporte, 120), 'N/A') AS fecha_emision_reporte

    FROM

    dbo.tblSolsInstrum_Solicitudes S

    WHERE

    id_usuario = 'car6527'

    ORDER BY

    2...

  • RE: Running a script using "osql"

    Have your script file update a log file. Before executing the next step in your program, check the log file to make sure log says the script ended sucessfully....

  • RE: MCDBA 2000 Study Guide Recommendations

    Check out the books that helped me pass on my blog.

    Good luck.

    HTH

Viewing 15 posts - 46 through 60 (of 95 total)