Forum Replies Created

Viewing 15 posts - 46 through 60 (of 91 total)

  • RE: Problem with creating a Foreign Key

    Common issue understanding the ways of the Foreign Key.

    Every now and then if I haven't done one in months... I gotta go look!

    Now which way does this thing go? ...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Problem with creating a Foreign Key

    Aha, I think I understand now. How about this...

    SELECT ParcelID from Field_Data where ParcelID not in

    (SELECT ParcelID from GIS_Data)

    Are any rows returned? Do all of the records...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Problem with creating a Foreign Key

    More for you Paul....

    The script I built was just so I can conceptually show you a simple example with your names. Run this script against a test blank test database.

    It...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Problem with creating a Foreign Key

    Hi Paul,

    I guess this comes down to the guts of a Foriegn Key. What you are saying in your design is that you don't want any records in the...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Problem with creating a Foreign Key

    A primary key is not needed, but a unique constraint at minimum.

    CREATE TABLE GIS_Data

    (ParcelID int)

    CREATE TABLE Field_Data

    (ParcelID int)

    INSERT into GIS_Data

    select 1 union

    select 2 union

    select 3 union

    select 4 union

    select 5...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Attaching a database with error 9004

    9004 is a corrupted log file. See http://msdn.microsoft.com/en-us/library/aa337407.aspx

    You may try...

    move your .ldf file out to a temp directory.

    IN Management Studio right-click> attach > add you .mdf file

    Remove the log...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: How to random dates

    I borrowed a bit of logic from Pinal Dave http://blog.sqlauthority.com/2007/04/29/sql-server-random-number-generator-script-sql-query/

    It will generate a random startdate and enddate between a range of dates. So in this example, setting @DateRangeStart to...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: SQL Server Express DAC

    The best QotD's are the one's that cause such outrage! Just think of this... these contoversial questions cause us all to go investigate, research, etc. Personally, you can...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Single user mode in SQL Cluster

    Found it! these folks ran accross the same issue. Looks like taking SQL resource offline from cluster administrator first does the trick.

    http://www.sqlservercentral.com/Forums/Topic485250-357-1.aspx#bm485257

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Single user mode in SQL Cluster

    What a puzzle! And I can't seem to find anything about it documented anywhere. Sort of a catch-22 right? Start the SQL instance in single-user mode, but some...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Selecting data in a grid?

    I've been playing around with it trying to get grasp on PIVOT as well:

    create table #temp

    (month int,

    category int,

    value int)

    insert into #temp

    select 1,1,10 union

    select 2,2,5 union

    select 2,1,10 union

    select 3,2,15 union

    select 4,1,10...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: sql clustering 2005 problems

    Hi Edwin,

    You could try running clusprep.exe

    http://www.microsoft.com/downloads/details.aspx?FamilyID=bf9eb3a7-fb91-4691-9c16-553604265c31&displaylang=en

    It runs some checks to see if you are properly configured for clustering.

    I wonder if maybe you don't have a problem with...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: sp_Msforeachdb

    Hi ezhil,

    I battled with this one for a while. Try this out...

    sp_MSforeachdb 'USE ? EXEC (''CREATE PROCEDURE TestProc AS BEGIN SELECT 1 END'')'

    The only way I could get...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: Partitioned tables

    Working on the same issue here, and have started playing with some queries using AdventureWorks. But yes.. you are correct. The idea is that new filegroups are created...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

  • RE: RTRIM and LTRIM??

    If in multiple columns and you've got leading or trailing spaces:

    CREATE TABLE #NAMES

    (FirstName varchar (25),

    LastName varchar (25))

    INSERT INTO #NAMES

    SELECT 'Bob ','Johnson ' UNION

    SELECT ' Bob',' Johnson' UNION

    SELECT...

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)

Viewing 15 posts - 46 through 60 (of 91 total)