Forum Replies Created

Viewing 15 posts - 391 through 405 (of 921 total)

  • RE: Dynamically determining a Top n for Top keyword

    
    
    CREATE PROC p_TopDrugs @Rows int AS
    SET NOCOUNT ON
    SET ROWCOUNT @Rows
    SELECT Drug_Name, COUNT(*)
    FROM Orders
    GROUP BY Drug_Name
    ORDER BY COUNT(*) DESC

    --Jonathan

  • RE: Name of table memorized into a variable

    quote:


    Have you thought about Multiple Words in table names Like Order Details

    🙂


  • RE: Name of table memorized into a variable

    
    
    DECLARE @sql varchar(200)
    CREATE TABLE #t(db sysname, own sysname, tab sysname, Col sysname, Seq tinyint, PKName sysname)
    SET @sql = PARSENAME(@TableName,3) + '.dbo.sp_pkeys ' + PARSENAME(@TableName,1) + ','...
  • RE: Transaction Log Backup

    quote:


    After every full backup I automatically run these 2 commands to reclaim the space the TLog has allocated:

    backup log DBName with truncate_only

    DBCC...

  • RE: New to SQL, have a version question

    Yes, every edition other than MSDE comes with the GUI utilities.

    --Jonathan

  • RE: .sql structure & data

    You can use DMO to script out creation scripts for database objects. There are a myriad of ways to get the data into a local file, from passing it...

  • RE: OT: Sybase Equivelant to MS SQL TOP?

    Sybase had TOP (and a synonym, FIRST) the last time I used it, several years ago. It did not have PERCENT or WITH TIES options, though.

    --Jonathan

  • RE: Returning SQL Error details to VB?

    In ADO you've got the Number, SQLState, and NativeError properties of each error object. I typically use the SQLState when testing expected conditions in an error handling routine, as...

  • RE: UPDATETEXT for multiple rows

    You're treating TEXTPTR() as static and it's not. Try this:

    
    
    DECLARE @TextPointer varbinary(16)
    DECLARE @ReplaceStr varchar(8000)
    DECLARE @SearchStr varchar(8000)
    DECLARE @DeleteLength int
    DECLARE @OffSet int

    SET @SearchStr = 'XXXX'
    SET @ReplaceStr...
  • RE: arithmatic function

    As you're wanting to truncate rather than round, I think cmore means:

    
    
    SELECT ROUND(1,-2,1)*ROUND(b,-2,1)

    If the vales are an integer data type, you could also just do something...

  • RE: arithmatic function

    Sorry; duplicate post. "Delete reply" still nonfunctional.

    Edited by - Jonathan on 11/25/2003 1:44:33 PM

  • RE: how to determine default backup directory?

    EXEC master..xp_regread 'HKEY_LOCAL_MACHINE','Software\Microsoft\MSSQLServer\MSSQLServer','Backupdirectory'

    --Jonathan

  • RE: Table constraints

    As there are no table constraints other than PRIMARY KEY and FOREIGN KEY in SQL Server, I presume you mean a column CHECK constraint.

    
    
    CREATE FUNCTION dbo.CntUser(@userid...
  • RE: Transaction Log Backup

    quote:


    Will running transaction log backups every two hours WITH INIT, NOSKIP keep the transaction from growing too large?


    November 25, 2003 at 8:58 am

    #483557

  • RE: Remove alpha characters

    If you're using SQL Server 2000, this is easy with a User Defined Function (UDF), e.g.:

    
    
    CREATE FUNCTION dbo.f_RemoveChars(@Input varchar(1000))
    RETURNS varchar(1000) AS
    BEGIN
    DECLARE @pos smallint
    SET @Pos = PATINDEX('%[^0-9]%',@Input)
    WHILE...

Viewing 15 posts - 391 through 405 (of 921 total)