Forum Replies Created

Viewing 15 posts - 2,401 through 2,415 (of 6,036 total)

  • RE: Scope of a variable

    DECLARE statement is not executeable at run time.

    It just reserves memory needed for variables (including table variables).

    Memory allocation happens when a script is being parsed and compiled.

    That's why no matter...

  • RE: Combine Insert Into Statements

    INSERT INTO dbo.wind0

    (datetime, maxspeeddeg )

    SELECT T.item, Cast(S.item as decimal(4,1))

    FROM dbo.GA T

    CROSS JOIN dbo.GA S

    WHERE (T.timeframe = 'actual' and T.sensor = 'date0' and T.cat = 'date' and T.unit = 'utc')

    AND...

  • RE: Stuck on "continuous date spans"

    Look not for continuous spans, looks for breaks longer than 1 day.

    The end of the latest of such breaks will be the beginning of the latest continuous span.

  • RE: Convert To UNICODE/NVARCHAR data

    By using or not using "N" you define the datatype of the string you supply to the parameter of the procedure.

    If "N" is missing then you supply non-unicode string and...

  • RE: Confusing set of strings!

    Another approach.

    Seems simpler to me.

    Step 1... make sure the code works as is.

    Step 2... wrap the code into stored procedure

    Step 3... make the query like this: 'EXEC dbo.StoredProcedure' [+ parameters]

  • RE: Determine the case of a table name

    Compare TABLE_NAME to UPPER(TABLE_NAME) using a case sensitive collation.

    Check what is your database default collation and choose similar one, but case sensitive.

    It should be going like this:

    select * from information_schema.tables

    WHERE...

  • RE: Stored Procedures that converts a table's column data type from char to nchar and varchar to nvarchar

    BEGIN

    select 'alter table ' + QUOTENAME(sysusers.name) + '.' + QUOTENAME(tables.name)

    Just in case...

  • RE: Return most recent of a sub group of records

    Jeff, a small correction.

    It should be:

    ...

    join sysdba.history h on h.accountid = maxdate.accountid AND h.startdate = maxdate.MaxStartDate

    ...

    🙂

  • RE: How using SQL to generate random string?

    DECLARE @Codes TABLE(

    Code binary(1) PRIMARY KEY

    )

    INSERT INTO @Codes (Code)

    SELECT CONVERT(binary(1), number)

    FROM master.dbo.spt_values

    WHERE Type = 'P'

    AND (number between 65 and 90 OR CHAR(number) LIKE '[0-9]')

    SELECT

    T1.Code + T2.Code + T3.Code...

  • RE: Strange Behaviour

    Schema evaluation happens during parsing time, not execution time (just like in any other programming language).

    So, there is nothing stange in this behaviour.

    P.S. Altering table schema on fly is one...

  • RE: execute sp_executesql COUNT(*) Output

    bjvaishnani (11/11/2009)


    DECLARE @SelectQueryNVARCHAR(MAX)

    DECLARE @WhereQueryNVARCHAR(MAX)

    SET @WhereQuery = ' WHERE COND1 and cond2'

    SET @SelectQuery = ' SELECT Col1, col2,, From Table1 ' + @WhereQuery

    SET @CountSQLQuery = N'SELECT COUNT(*)

    FROM

    dbo.Table1 ' +...

  • RE: Can I make it efficient????

    Since you don't have any WHERE clause you're pretty much doomed to scan whole table every time the report is called.

    All the millions of rows.

    If your requirement is to get...

  • RE: Trigger for Auditing Data on Table Text Field

    You may join inserted and deleted tables by primary/unique key to the base table and grab text values from there.

    Insert into Meet_Master_Log (ActionTaken, Meeting, Title,Description,LogDate,LogBy)

    Select

    Case

    When inserted.Meeting is null then 'D'

    When...

  • RE: Query Perfomance problems

    Index on eventDuedate should be clustered.

  • RE: Need help on Dynamic SQL

    You may get rid of dynamic SQL problems by converting "Excel-style" tables to more appropritate form:

    CREATE VIEW dbo.tPosiDtl_2009

    -- view which contains all records for the whole year

    AS

    select TID,...

Viewing 15 posts - 2,401 through 2,415 (of 6,036 total)