Forum Replies Created

Viewing 15 posts - 331 through 345 (of 1,183 total)

  • RE: Insert All Unique Combinations - Without a Loop

    DB Dan (4/15/2011)


    Try the following

    SELECT t2.EntityID, t1.EntityID

    FROM @NewEntities t1

    CROSS JOIN @NewEntities t2

    WHERE t1.ID < t2.ID

    ORDER BY t2.ID DESC

    Dang-It Dan!!!!

    That was TOO EASY. I was going down a rabbit hole...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Insert All Unique Combinations - Without a Loop

    Goldie Lesser (4/15/2011)


    Hi,

    .............

    For example, I start with a list of entities: 32, 54, 67, 148.

    I would need to insert the following values into the enemies table.

    OriginalID | EnemyID

    148 | 54

    148...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: The Job Posting - Do I really have to be the SQL God?

    Koen Verbeeck (4/14/2011)


    fname lname-1111520 (4/13/2011)


    I get it: "then", "than", "there's", "there are". Stop reading (and I did), it can't be coherent.

    Oink? You stop reading a technical article...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Copy data from one database to another T-Sql Help

    http://www.red-gate.com/products/

    These tools are the best! They've saved me so much time over the years it's not even funny. And before you ask, I don't work for them. 🙂

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Copy data from one database to another T-Sql Help

    Are you going to want reapply those constraints? Because you won't be able to, and your data will all kinds of mixed up. Unless you know there isn't a possibility...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Looking for a job and need advice on learning MSSQL 2005/2008 without job experience

    With respect to #1:

    1. Hone your SQL skills on 2000, and I mean really nail them down. Understanding set based theory at more than a "I can write SQL, and...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: parameter enable and disable on basis of value..tricky and messy

    Daniel Bowlin (4/12/2011)


    I don't think you can do that. If someone else has a way I would love to see it.

    What I would try is to have only one...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Find records that have >=3 occurrences in 4 days?

    Mr Corn Man (4/12/2011)


    I guess I should have clarified again that if there are records that fall before/after the 4-day window that 3 or more calls occurred in, they would...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Basic concat over 500 times slower than straight select?

    I may be missing something obvious here, but the name of the table comes from sys.tables, and that's NVARCHAR, not VARCHAR. Regardless of what your tables are named an NVARCHAR...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Find records that have >=3 occurrences in 4 days?

    Mr Corn Man (4/12/2011)


    How would your suggestion work with the updated table structure I posted?

    Also, the table has ~6M rows in it, so I can't really input the data the...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: cant get round function to two decimal place?.

    normanshongo2003 (4/12/2011)


    select last_name,department_no, (Annual_Salary/12) as 'Monthly Salary'

    from Employees

    where Department_No='90'

    this will show the monthly salary but when i put in ,2 it wont do two decimal places?

    ive used the round function...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: cant get round function to two decimal place?.

    Help us help you!

    Why not give us some sample data? Ideally, the data that is returning in the unwanted format, and the exact code you're running.

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Code Help

    You can't use the variable @DBname in your query like that. You'll need to use dynamic SQL. 😀

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: How to find Row number

    Pink123 (4/11/2011)


    No the temp table doesnt have any rownumbers.

    It sjust

    insert into #temptable

    select ....

    from ...

    then I do a select rownumber as mentioned in my query and it gives rowcount as...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • RE: Find records that have >=3 occurrences in 4 days?

    How about .....

    declare @t table (PHONE_NBR varchar(12), CALL_DATE datetime)

    insert @t

    select '3215551234','04/10/11' union all

    select '3215551234', '04/11/11' union all

    select '3215551234', '04/11/11' union all

    select '3215551234', '04/14/11' union all

    select '3215551234'...

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg

Viewing 15 posts - 331 through 345 (of 1,183 total)