Forum Replies Created

Viewing 15 posts - 18,271 through 18,285 (of 18,926 total)

  • RE: SProc Syntax Error

    I tried the code in a stored proc and it returned the error as expected without any furter message. The problem comes when you try to return a value...

  • RE: Determining existance of a Table in SYSOBJECTS

    Now I understand why you have so many posts Frank... You type 2-3 responses when none or 1 could do .

  • RE: Adding text to the results of a select statement

    You could always do something like this :

    Select 'This is a tables "' + name + '" / id = ' + cast(id as varchar(10)) from dbo.SysObjects where XType...

  • RE: referential integrity for two foreign key based on same primary key

    Tried on my machine too. Looks like ms forbids you to do this as it could become some kind of infinte loop or something like that. Maybe someone...

  • RE: top n percent WITH group by?

    Here's another thaught: the in clause will kill the performance because the whole list will be scanned untill a match is found. Since

    where 1 in (3,1,2)

    is the same...

  • RE: top n percent WITH group by?

    I also thaught of something similar but I didn't pursue it because I wanted a set based approach. This temp table solution would however be much faster than the...

  • RE: Passing parameter to UDF

    try running this... it works for me :

    CREATE FUNCTION [dbo].[ufn_WeekdaysBetween]

    (@StartDate datetime, @EndDate Datetime)

    RETURNS int

    AS

    BEGIN

    DECLARE @Day1 int

    DECLARE @Day2 int

    SET @Day1 = Datepart(dw, @StartDate)

    SET @Day2 = Datepart(dw, @EndDate)

    DECLARE @dSunday...

  • RE: Passing parameter to UDF

    Sorry but we don't see anything here.. can you just post the code and err message?

  • RE: IF Exists stored procedure

    IF EXISTS(SELECT User_ID FROM dbo.User_Information

    WHERE First_Name = @FirstName AND Last_Name = @LastName AND Email_1 = @Email)

    begin

    Select col1, col2... from YourTable

    return 1

    end

    else

    begin

    return 0

    end

  • RE: optimize this query?

    This wouldn't be any faster than PW's solution. The advantage that PW's solution has is that an index can be used on the date because no modification has to...

  • RE: Variable data movement

    Select C.company, E.fname, E.lname, ISNULL(e.Phone, C.phone) as Phone

    from tblCompany C inner join tbkEmployees E on C.id = E.companyidfk

    You just need to apply this technique to the insert/update statement you will...

  • RE: top n percent WITH group by?

    Here's somthing to play with (I wouldn't recommend it on a 8 M lines table though).

    SELECT O.XType

    --, count(*) AS TotalHits_Found

    , O.name

    , (SELECT CEILING(COUNT(*) * 0.9) FROM dbo.SysObjects O4 WHERE...

  • RE: Auto-generate SQL Script for entire DB?

    One way to accomplish this would be to do a backup of A and restore to B.

  • RE: Query test for just date of smalldatetime

    This solution has already been posted, also if you only want the date portion you're still better off using dates than strings as they will compare must faster than varchars.

  • RE: Query test for just date of smalldatetime

    Have you actually run this statement??

    select CAST(dateadd (d, 0, datediff(d, 0, getdate())) AS SMALLDATETIME)

Viewing 15 posts - 18,271 through 18,285 (of 18,926 total)