Forum Replies Created

Viewing 15 posts - 5,881 through 5,895 (of 6,395 total)

  • RE: SQL SERVER sp_msforeachdb

    if you only need data from one database then you dont need to use sp_msforeachdb.

    issue the following and post the results

    sp_msforeachdb 'USE [?]; SELECT TOP 1 * FROM sysobjects'

  • RE: SQL SERVER sp_msforeachdb

    if you do

    select count(*) from sys.databases

    does it return 23 rows?

    what your seeing is that you have used sp_msforeachdb but telling it to go back to the chapter database so what...

  • RE: SQL SERVER sp_msforeachdb

    The T-SQL in my first post used sp_msforeachdb and loops through to get all records from sys.tables in each DB

  • RE: Best approach for record comparison

    feeling helpful today

    CREATE TABLE #TEMP

    (CustomerID INT,

    ServiceType VARCHAR(20),

    StartDate DATE,

    EndDate DATE)

    INSERT INTO #TEMP VALUES (1234, 'ServiceA', '2010-05-25', '2011-07-15')

    INSERT INTO #TEMP VALUES (1234, 'ServiceA', '2011-07-16', '2011-09-18')

    INSERT INTO #TEMP VALUES (1234, 'ServiceB', '2011-09-19', NULL)

    INSERT...

  • RE: SQL SERVER sp_msforeachdb

    I take it you want all the tables from each database?

    sp_MSForEachDB 'USE [?]; SELECT * FROM sys.tables'

  • RE: DB Mail

    Loundy (2/21/2012)


    I believe you also need to enable mail session in sql agent

    Don't think this will be causing your error though - just thought i'd point it out 🙂

    this is...

  • RE: DB Mail

    seems like the smtp server is not accepting your IP as an SMTP client.

    are you using Exchange? has the servers IP been granted the nessesary access on the SMTP...

  • RE: scripting all stored procedure through T-SQL

    Does it have to be done in T-SQL?

    You could right a few lines of code in powershell which will loop through all the procedures and dump it out to a...

  • RE: Migrating user sql server 2000 to sql server 2008..?

    could also use SSIS with the transfer logins tasks

  • RE: Need help with a SQL select statement

    Please provide the full DDL and sample data along with your expceted results so we can assit you better.

    Please see the first link in my signature for more info.

  • RE: Ranking in each other

    Cadavre (2/20/2012)


    BEGIN TRAN

    --Sample data

    SELECT X,Y

    INTO yourTable

    FROM (VALUES('A', 'B'),('A', 'B'),('A', 'C'),('A', 'C'),('A', 'C'))a(X,Y)

    --Solution

    SELECT X,Y,

    ROW_NUMBER() OVER(PARTITION BY X,Y ORDER BY X,Y) AS SEQ

    FROM yourTable

    ROLLBACK

    damn that was fast

  • RE: Ranking in each other

    create table #temp (x char(1), y char(1))

    insert into #temp values ('a','b')

    insert into #temp values ('a','b')

    insert into #temp values ('a','c')

    insert into #temp values ('a','c')

    insert into #temp values ('a','c')

    select row_number() over(partition by...

  • RE: Annimated GIF avatars

    Steve Jones - SSC Editor (2/20/2012)


    I see it's working. Yikes, I hope that's not how you feel most days :w00t:

    Nope, thankfully since I have moved on from the old position...

  • RE: Keyboard Shortcut to Results Window in SSMS

    here is another link as well, this one is a bit more printer friendly

    http://www.simple-talk.com/sql/sql-training/ssms-the-query-window-keyboard-shortcuts/

  • RE: sys.sysprocesses

    how do you determin that the session is closed?

    are you sure its just not SQL reassigning the SPID to a different connection?

Viewing 15 posts - 5,881 through 5,895 (of 6,395 total)