Forum Replies Created

Viewing 15 posts - 406 through 420 (of 907 total)

  • RE: Default Directories

    To easy. Why was I trying to make this a registry hack.

    Thanks.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

  • RE: Stored procedure changed date

    In the sysobjects table there is a columns called schema_ver. BOL defines it like this:

    Version number that is incremented every time the schema for a table changes.

    If you keep...

    Gregory A. Larsen, MVP

  • RE: converting int format to datetimevformat

    I'm guessing your date_entered field is the number of days since 01/01/0000. If this is so, then I think you need to try something like this:

    create table test (date_entered...

    Gregory A. Larsen, MVP

  • RE: select specific part of a string at a variable pos

    You should be able to use charindex, substring and len functions to do this. Try something like:

    Select substring(column_to_seach,charindex('Outlays recovered :',column_to_search) + 20,len(column_to_search))

    Gregory Larsen, DBA

    If you looking for SQL Server...

    Gregory A. Larsen, MVP

  • RE: Select Only Numeric Data

    You could create a function like so:

    CREATE FUNCTION only_num

    (@input char(100))

    RETURNS char(100)

    AS

    begin

    declare @output char(100)

    set @output = ''

    while len(@input) > 0

    ...

    Gregory A. Larsen, MVP

  • RE: how I find if a job is running or not?

    Try something like this, and insert results into a table then test the current_execution_status.

    exec msdb..sp_help_job @job_name = '<yourjob>', @job_aspect = N'job'

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check...

    Gregory A. Larsen, MVP

  • RE: Pivot SQL Server Tables

    I have a couple of pivot query examples that might get you started. Check them out here:

    http://www.geocities.com/sqlserverexamples/#pivot1

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website...

    Gregory A. Larsen, MVP

  • RE: Inserting records back into source table

    Possibly your insert statement did not add any row, but ran correctly. Is it possible your insert statement did not select any rows to be inserted? What does...

    Gregory A. Larsen, MVP

  • RE: HELP!! Procedure to split one record into two????

    So did my second post, using the LESS THAN 1200 work?

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

  • RE: HELP!! Procedure to split one record into two????

    I misread it again. Looks like you also want to set the EndWork on those original records set to 2400.

    Think this should do it:

    Update [dbo].[TimeTable]

    set [EndWork] = 2400

    where...

    Gregory A. Larsen, MVP

  • RE: HELP!! Procedure to split one record into two????

    Did I misread your post? Your example shows a record with an EndWork value of less than 1200 (0630 is less than 1200). Try this:

    Insert into [dbo].[TimeTable]

    ([EmployeeID],

    [RecordDate],

    [Beginwork],

    [lunchOut],

    [lunchIn],

    [EndWork],

    [CostCenter])

    select...

    Gregory A. Larsen, MVP

  • RE: HELP!! Procedure to split one record into two????

    Run this to verify that you do have [EndWork] values > 1200:

    select [EmployeeID],

    [RecordDate],

    0000,

    [lunchOut],

    [lunchIn],

    [EndWork],

    [CostCenter] from [dbo].[TimeTable]

    where

    [EndWork] > 1200

    If this command returns no records then there is no records to split....

    Gregory A. Larsen, MVP

  • RE: HELP!! Procedure to split one record into two????

    Test this and see if it works:

    Insert into [dbo].[TimeTable]

    ([EmployeeID],

    [RecordDate],

    [Beginwork],

    [lunchOut],

    [lunchIn],

    [EndWork],

    [CostCenter])

    select [EmployeeID],

    [RecordDate],

    0000,

    [lunchOut],

    [lunchIn],

    [EndWork],

    [CostCenter] from [dbo].[TimeTable]

    where

    [EndWork] > 1200

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

  • RE: TOP x within group

    Sometimes a cursor and a temp table is faster. Here is another stab at what you are looking for. Also note that I ran both these examples in...

    Gregory A. Larsen, MVP

  • RE: Forcing SQL Server Agent to Fail

    The key was to use raiserror with a state of 127. Thanks. Here is something that works

    select zxcvxvsdfgsdfasegfwergbetbetgsefrwefwerwer

    go

    IF (@@ERROR <> 0)

    RAISERROR ('command failed.', 16, 127)

    Gregory Larsen, DBA

    If you...

    Gregory A. Larsen, MVP

Viewing 15 posts - 406 through 420 (of 907 total)