Forum Replies Created

Viewing 15 posts - 2,386 through 2,400 (of 3,543 total)

  • RE: Need help bulding a query in SQL server

    temp tables (prefixed with #) are created in the tempdb database with the name you give it plus additional that is added by sql to make it unique. These temp...

  • RE: Need help bulding a query in SQL server

    OK, lets see if we can define it further.

    Assuming following ddl

    attrSFloat itemID int, attrID int, value float

    attrRFloat itemID int, attrID int, minvalue float, maxvalue float

    attrString itemID...

  • RE: Query - Data Function

    Answer to 2)

    Select Firstname,Lastname,Address,Employee_Id

    From Employee

    Where Employee_Id = ISNULL(@ID,Employee_Id)

    or

    Select Firstname,Lastname,Address,Employee_Id

    From Employee

    Where @ID IS NULL OR Employee_Id = @ID

  • RE: Sum in Exists Clause

    Volume will be the killer here.

    Whatever solution you use must at least aggregate the Detail table. So the choice is where and when. I see two possibilities.

    Create a sub query...

  • RE: Need help bulding a query in SQL server

    My suggestion would be to create a temp table of the attributes (attrID and value) from the tblSearchCr table (ignoring non supplied entries). Count the number of rows...

  • RE: Extracting binary data from an image field

    Use SUBSTRING to get data, eg 

    DECLARE @wanted varchar (1000)

    SELECT @wanted = SUBSTRING(pr_info,1,1000)

    FROM pubs.dbo.pub_info

    WHERE pub_id = 9901

    SELECT @wanted

    Of course you are limited to 8000 (varchar), 4000...

  • RE: TOP command (Last 6 Orders) ?

    Assuming orderno is unique

    SELECT c.custno, h.entrydate, h.orderno 

    FROM customers c

    INNER JOIN [order-header] h

    ON h.custedp = c.custedp

    WHERE h.orderno IN (SELECT TOP 6 h2.orderno

    FROM [order-header] h2

    WHERE h2.custedp =...

  • RE: Frank''''s Addition to Family

    Congrats Frank

    quoteHey Dave, what...
  • RE: Unknown Number of Multiple Date Ranges in WHERE Clause

    First, get the client app to convert the selected dates and ranges (formatted) into a single string eg yyyymmdd,yyyymmdd,yyyymmdd etc

    If performance is acceptable (depending on size of table, indexes etc) then

    WHERE...

  • RE: Exists some table that the alters of SP are registered?

    If you want to capture the date/time of table changes then

    create table changelog (table_name sysname, base_schema_ver int, change_date datetime)

    insert into changelog (table_name, base_schema_ver, change_date)

    select [name],base_schema_ver,GETDATE()

    from sysobjects

    where...

  • RE: Help with Select Statement (involving dates)

    See if this works

    DECLARE @yy int, @mm int, @yymm int, @rowct int, @intAddressID int

    SET @yy = year(GETDATE())

    SET @mm = month(GETDATE())

    SET @yymm = (@yy * 100) +  @mm

    SET...

  • RE: write multiple lines to DOS file with xp_cmdshell

    Try this

    DECLARE @cmd varchar(255)

    SET @cmd = 'echo line 1 > C:\outfile.txt && echo line 2 >> C:\outfile.txt'

    EXEC master..xp_cmdshell @cmd

  • RE: SID Mapping

    Something like this

    exec sp_msforeachdb @command1 =

    N'select ''?'' as [database],u.[name],u.sid,l.[name] as [login]

    from ?.dbo.sysusers u

    inner join master.dbo.syslogins l

    on l.sid = u.sid

    where u.issqluser = 1'

  • RE: Query Date Range Against Date Range

    You have staff who are contracted (with date ranges)

    You have jobs (with date ranges)

    and you want see if any staff can fulfill any jobs

    Questions

    Where is the relationship between staff and...

  • RE: Exists some table that the alters of SP are registered?

    quoteI have altered a table by enterprise manager and then i look into the SysObject and there is...

Viewing 15 posts - 2,386 through 2,400 (of 3,543 total)