Forum Replies Created

Viewing 15 posts - 61 through 75 (of 78 total)

  • RE: CONVERT DECIMAL values to HH:MM:SS

    try this...

    IF OBJECT_ID('tempdb..#Foo') IS NOT NULL

    DROP TABLE #Foo

    CREATE TABLE #Foo

    (

    DecimalData decimal(10,9)

    )

    INSERT INTO #Foo VALUES(0.03464120)

    INSERT...

    Gary Johnson
    Sr Database Engineer

  • RE: Script system stored procedures in master?

    rbarryyoung (9/3/2008)


    The script generator does not always work (bugs, fails on certain syntaxes), also cannot be automated and isn't very flexible. Plus there are things that it will not...

    Gary Johnson
    Sr Database Engineer

  • RE: Script system stored procedures in master?

    IMHO, even though you can use TSQL to get the information, I would still simply right click on Master in the Object Explorer window and then click on Tasks/Generate Scripts......

    Gary Johnson
    Sr Database Engineer

  • RE: Script system stored procedures in master?

    Hey, this is neat. I hadn't found the sys_modules before. So much easier than having to concatenate the syscomments text field!

    Run the following with results to text. It'll script out...

    Gary Johnson
    Sr Database Engineer

  • RE: Running Jobs from Command Prompt

    I think in this instance, I would create an SSIS package that does what you want. Then call the package on the command line.

    Or I would simply use SQLCMD statements...

    Gary Johnson
    Sr Database Engineer

  • RE: Inserting Dates and Day-of-Week into columns ...

    While you CAN make a database that uses the actual date, the question sometimes becomes SHOULD I.

    We have a table with over 15.5 billion rows in it (increases daily...

    Gary Johnson
    Sr Database Engineer

  • RE: Debugging Stored Procedures

    While being able to step through the code in Visual Studio is very helpful, don't discount using print and select statements as well. I will often have a parameter for...

    Gary Johnson
    Sr Database Engineer

  • RE: Update field problem

    If you are using 2005 you would be able to use the new Rank feature to do your cross tab rather than my Right function.

    Gary Johnson
    Sr Database Engineer

  • RE: Update field problem

    Give this a try...

    IF OBJECT_ID('tempdb..#Wrk') IS NOT NULL

    DROP TABLE #Wrk

    IF OBJECT_ID('tempdb..#SubParts') IS NOT NULL

    DROP TABLE #SubParts

    CREATE TABLE #SubParts

    (

    ...

    Gary Johnson
    Sr Database Engineer

  • RE: What is the Maximum Page Size in SQL Server 2000?

    Steve,

    Great job! I've run into this a few times. And it has always puzzled me why the 8060 wasn't correct. Now I know. Thanks!

    Gary Johnson
    Sr Database Engineer

  • RE: Granting Object Permissions on Tables

    Try something like this...

    SELECT 'GRANT SELECT, INSERT, UPDATE ON ' + name + ' TO faelogin'

    FROM sysobjects

    WHERE type = 'U' and status >= 0

    Then copy the resulting script and run...

    Gary Johnson
    Sr Database Engineer

  • RE: Stored Procedure Naming Conventions

    Naming conventions are difficult to make useful ALL OF THE TIME. I'm currently working at a place that uses a strict naming convention. Our SPs are named by project_method_action_sp. Unfortunately...

    Gary Johnson
    Sr Database Engineer

  • RE: Query Analyzer Extended

    A long time ago I came across an sp called sp_select on the old site. I have since taken that sp and modified it, munged it so that now I have...

    Gary Johnson
    Sr Database Engineer

  • RE: order by just time

    The easiest way would be to use the convert as above but use switch 8 instead of 113. That will give you just hh:mm:ss. If you need milliseconds you can...

    Gary Johnson
    Sr Database Engineer

  • RE: Reading an Excel File from SQL Server

    Try this from BOL

    SELECT *

    FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',

      'Data Source="c:\Finance\account.xls";User ID=Admin;Password=;Extended properties=Excel 8.0')...xactions

    Also note that everything inside the parenthesis can not be set to a variable so if it needs to change...

    Gary Johnson
    Sr Database Engineer

Viewing 15 posts - 61 through 75 (of 78 total)