Forum Replies Created

Viewing 15 posts - 2,596 through 2,610 (of 3,543 total)

  • RE: Using variables in CURSOR declarations

    DECLARE @sql nvarchar(100)

    SET @sql = 'DECLARE cr CURSOR FOR SELECT * FROM ' + @tname

    EXEC (@sql)

    OPEN cr

    CLOSE cr

    DEALLOCATE cr

  • RE: How to merge the string ?

    If you want to use text for the output because the concatenation will be greater than 8000 then you will not be able to achieve this in a single query.

    A...

  • RE: Query Help Please

    SELECT c.CurrencyRateCode, SUM(ISNULL(m.Match,0))

    FROM (SELECT DISTINCT CurrencyRateCode FROM CurrencyRates) c

    LEFT OUTER JOIN (SELECT CurrencyRateCode,1 AS Match

    FROM CurrencyRates

    WHERE DATEADD(month,RateMonth-1,DATEADD(year,RateYear-1900,''))

    BETWEEN @StartDate AND @EndDate ) m

    ON m.CurrencyRateCode =...

  • RE: DTS to import data from Pervasive SQL 8 to SQL Server 2000

    OK some simple instructions to get you going

    In EM (Enterprise Manager), expand your server

    Select your target database

    Right click on the target database, select All Tasks, Import Data

    You will then...

  • RE: how do i check default language setting

    Default Language is per login. Look under Security / Logins in EM. You can change the value there as well.

  • RE: Converting DATETIME to NUMERIC

    ps

    To answer your question, the following is from BOL

    Values with the datetime data type are stored internally by Microsoft SQL Server as two 4-byte integers. The first 4 bytes store...

  • RE: Converting DATETIME to NUMERIC

    This will give you the start and end datetime for 10 intervals from the start datetime

    declare @start datetime,@interval int

    set @start = '2004-01-02 21:12:58.000'

    set @interval = datediff(ms,'','1900-01-01 01:23:34')

    select...

  • RE: How to join on data in a long text field

    SELECT A.FORMTITLE, B.COLNAME, A.HTML

    FROM DBO.SMSYSBASEVIEWDATA B

    INNER JOIN DBO.NAMSYSHTMLFORMS A

    ON A.HTML LIKE '%<INPUT id=' +

      CAST(B.COLNAME as varchar) +

      ' % DEType="' +

      CAST(B.DEType as...

  • RE: OLE DB and Microsoft Directory Services

    I have had some success with these two queries

    SELECT *

    FROM OpenQuery( ADSI,'<GC://xxx.co.uk>;(&(objectCategory=person)(objectClass=user));cn,distinguishedName,name,givenName,sn,sAMAccountName,department,mail,adspath;subtree')

    SELECT cn,distinguishedName,name,givenName,sn,sAMAccountName,department,mail,adspath

    FROM OPENQUERY(ADSI,

    'SELECT cn,distinguishedName,name,givenName,sn,sAMAccountName,department,mail,adspath

    FROM ''LDAP://servername'' WHERE objectCategory = ''CN=Person,CN=Schema,CN=Configuration,DC=xxx,DC=co,DC=uk'' AND objectClass= ''user''')

    The big problem I found is that ADSI...

  • RE: Linking "text" item with "numeric" item -- Please HELP !

    Use cast to convert text to int/numeric

    OFFERITEMS ON ITEMMAST.EDPNO = CAST(SUBSTRING(OFFERITEMS.OFFERITEM, 9, 8) as int)

  • RE: Create Trigger from within ActiveX Script

    CRLF is not a known variable and activex will create an empty variable.

    Try putting

    CRLF = chr(13) & chr(10)

    at the beginning of your script

     

  • RE: Count(distinct columnName) Problem

    OK, my solution did not distinct the SerialNumbers for Directs. Your solution will give an erroneous Direct count if there are no Directs for a day.

    Try this

    SELECT SUM(Direct) AS [Direct],

    SUM(Total)...

  • RE: Space usage qtn: decimal (18,2) vs decimal (9,2)

    BOL (Books Online) is as good a place as any. Look up numeric data type, fixed precision and scale.

    Precision 18 uses 9 bytes

    Precision 9 uses 5 bytes

    AFAIK the consumption is...

  • RE: Trim functions and Unicode fields??

    What are you looking at to determine the two spaces?

    RTrim works with nvarchar, eg

    declare @x nvarchar(20)

    set @x = 'Daytona  '

    select cast(@x as varbinary)

    select cast(rtrim(@x) as varbinary)

    select '"'+rtrim(@x)+'"'

    gives

    0x44006100790074006F006E00610020002000

    0x44006100790074006F006E006100

    "Daytona"

  • RE: Converting int to char with 0 Fill

    SELECT REPLACE(STR(748,6,0),' ','0')

Viewing 15 posts - 2,596 through 2,610 (of 3,543 total)