sql

  • CREATE TABLE Numbers(n INT NOT NULL identity(1,1),name char(50),todaydate date,

    power2 int not null,name1 varchar(50),name2 varchar(30))

    --loop for insert

    DECLARE @i INT;

    SET @i = 1;

    WHILE @i<100

    BEGIN

    INSERT INTO Numbers values('ha',SYSDATETIME(),POWER(2,2),'gelab','tsgnti')

    set @i=@i+1;

    END;

    select * from numbers

    use master

    use LNSQLTSGT11_db1

    -------------------------------------

    --script for adding temp datafiles

    use tempdb

    DECLARE @name1 VARCHAR(11)--instnce name

    DECLARE @path VARCHAR(50)----path for temp db

    DECLARE @fileName VARCHAR(256)----File name for destination

    DECLARE @temp varchar(50)

    set @temp='data\'

    DECLARE @temp1 varchar(100)

    set @temp1='tempdb'

    SET @path ='t:\'

    declare @name char(100)

    set @name1= cast(( select SERVERPROPERTY('instancename')) AS char)

    set @filename=@path+@name1+'\'+@temp+@temp1

    print @filename

    alter database tempdb

    add file(name=tempdev1,filename=@filename,size=500)

    -------------------------------------------------------

  • Do you have a question about this?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply