Forum Replies Created

Viewing 15 posts - 1 through 15 (of 33 total)

  • RE: SQLCMD Mode; Run all SQL files in a directory

    u can also use CLR and run all the code from T-SQL

  • RE: SQL Server 2014 - Service Pack 1?

    SP1 for SQL 2014 has been released but has been redrawn because of installing issue with SSIS.

  • RE: Using WHILE to avoiding Cursor

    U should try to use a set-based statement, while or cursors are both loops.

    I think u can use something like:

    Insert into [dbo].[bt]([ref],[deprec],taxa)

    SELECT col1, --do stuff here

    FROM @table1

    WHERE...

  • RE: The Worst Comments

    --do something

    --do something else

    --not sure what this does

    --changed

  • RE: Pass table type param to stored proc in another database

    having the exact same thing:

    use [db1]

    CREATE type dbo.ParetoValues2 as table ( RowNbr bigint primary key not null,Val float)

    use [db2]

    CREATE type dbo.ParetoValues2 as table ( RowNbr bigint primary key not null,Val...

  • RE: Parsing Parameters in a Stored Procedure

    The use of table-valued parameters in SQL Server 2008 removes the need for these comma separated parameters.

    But if you need something like this you could use a CLR function or...

  • RE: Forgein Key Checks

    Thx I didn't know that you could do it like that.

    If you run that statement and all data is consistent and the foreign key will be placed and everything new...

  • RE: Forgein Key Checks

    CREATE TABLE dbo.cnst_example

    (id INT NOT NULL,

    name VARCHAR(10) NOT NULL,

    salary MONEY NOT NULL

    CONSTRAINT salary_cap CHECK (salary < 100000)

    );

    -- Valid inserts

    INSERT INTO dbo.cnst_example VALUES (1,'Joe...

  • RE: Datediff excluding weekends

    I use this function:

    CREATE FUNCTION [System].[fn_NbrOfWorkingDays] (@StartDate as datetime,@EndDate as datetime)

    RETURNS int

    WITH SCHEMABINDING,RETURNS NULL ON NULL INPUT,ENCRYPTION

    AS

    BEGIN

    RETURN(

    SELECT days/7*5 + days%7--calc workingdays

    - CASE WHEN 6 BETWEEN...

  • RE: Forgein Key Checks

    I handle the situation by putting all my FKrelations in a metadata tables.

    Then I created a procedurte that checks alle these Foreign Keys (add indexes upfront do speed up)

    Next a...

  • RE: Define A Conditional Forigion Key

    This can be done with trigger and procedures I think but it won't be easy.

    You can't use a foreign key based on some condition.

    A trigger in which you use...

  • RE: Database Size

    this is not a good question because you can set sql so that a new database is initiated with 1gb of size.

    This is the 3d question today which the question...

  • RE: Predict output

    the select only returns 1 2 4 5 .

    this is an exception is not returned by the select, so actually i don't feel this is a good question.

    I knew which...

  • RE: Query cost

    Exists is more efficient then in but the possible anwsers; Wrong Answer, Right and Wrong .. think something went wrong here.

  • RE: Temporal Types EXTRACT

    I'm not sure what you want but you could use:

    SELECT YEAR('2010-03-22'),MONTH(DATEADD(m,1,'2010-03-22'))

    or you could take year month and add 01 to create a string that you convert to datatime.

    To find ast...

Viewing 15 posts - 1 through 15 (of 33 total)