Forum Replies Created

Viewing 15 posts - 31 through 45 (of 77 total)

  • RE: Make databasename / schema a variable in select statement

    If you are running the batch of sequential scripts from batch file using SQLCMD try doing this...

    SELECT * FROM $(DatabaseName).dbo.tablename

    Then you simply set an environment variable in your command file...

  • RE: Embedding function calls in a query

    You can do a work around that would allow that to be done. BUT performance would likely be terrible. In my experience inline funtions like that perform horribly.

    Why can't...

  • RE: Need help to figuer out trouble shoot stored proc.

    To debug in Visual Studio you need to open the Server Explorer window. Add a data source for your database. Then drill down to the stored procedure. Right click on...

  • RE: Need help to figuer out trouble shoot stored proc.

    First thing I would do is to put a lot of debugging select statements and print statements in the SP (I wrap them in a comment block to know where...

  • RE: Selecting multiple columns into one

    How about this?

    declare @Sql nvarchar(max)

    SET @Sql = ''

    SELECT @Sql = @Sql + ' SELECT ' + name + ' FROM dbo.Property UNION' + char(13) + char(10)

    FROM sys.columns

    WHERE object_id = object_id('Property')

    SET...

  • RE: NULL VALUES

    Hmmm... I would have written it this way.

    DELETE t3

    FROM dbo.Table_3 t3

    JOIN dbo.Table_1 t1

    ON t3.Reqnr = t1.Reqnr

    ...

  • RE: SELECT INTO FROM.. or INSERT INTO..?

    Great news on the new minimal logging ability in 2008! I'm sure as we move data around quite often we will look for that feature.

    This might just be one...

  • RE: MISSING CONSTRAINTS AND TRIGGERS

    Let me get on my soap box.

    If you were to have scripts in source control for every object in your database this would be a non issue. 🙂

    Getting off...

  • RE: SELECT INTO FROM.. or INSERT INTO..?

    Ninja's_RGR'us (9/9/2008)


    There's no way in hell that Select into was the only contributing factor in this.

    Are you sure you didn't have other problems like blocking, index building, too much data...

  • RE: NOLOCK Discussion

    IMHO, WITH(NOCLOCK) is a tool like any other sql statement. Used incorrectly it can certainly bite ya. But so can many other things in SQL! 🙂

    Our web facing data is...

  • RE: Result set with a predefined 1st line and last line...

    I have to ask. What is this for?

    Sounds like you are creating a flat file with a header. Yuk...

    I would create an SP that has a temp table you...

  • RE: SELECT INTO FROM.. or INSERT INTO..?

    SELECT INTO will often times be significantly faster. BUT it locks up the sysobjects table while it runs. So, if you have any other SPs or scripts(that need to DDL...

  • RE: Populating a sort order column based on string data

    OK.. Well this is a little more dynamic 🙂

    IF OBJECT_ID('tempdb..#units') IS NOT NULL

    DROP TABLE #units

    CREATE TABLE #units (

    buildingINT,

    unitVARCHAR(25),

    sort_orderINT

    );

    INSERT INTO#units

    ( building, unit )

    SELECT 1, 'A' UNION ALL

    SELECT...

  • RE: Collation Latin1_General_CI_AS stands for?

    It is actually a combination of both what Mark and GSquared posted. It means that SQL Server is going to use the Code Page 1252 characters and searches are Case...

  • RE: Problem With Excluding Records

    If your CityType field is null where you don't have a primary city you should be able to simply use Coalesce.

    SELECT DISTINCT

    st.city,

    ...

Viewing 15 posts - 31 through 45 (of 77 total)