Forum Replies Created

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

  • RE: How to get index fragmentation of a database with query ?

    sys.dm_db_index_physical_stats can be used in all DB

    just right click on YourDatabase then select New Query

    in that query window run query which i have posted.

    Just write DBname with USE you...

  • RE: How to get index fragmentation of a database with query ?

    Try this one

    select a.*,b.AverageFragmentation from

    (

    SELECT

    tbl.name AS [Table_Name],

    tbl.object_id,

    i.name AS [Name],

    i.index_id,

    CAST(CASE i.index_id WHEN 1 THEN 1 ELSE 0 END AS bit) AS [IsClustered],

    CAST(case when i.type=3 then 1 else 0 end AS...

  • RE: can i get result of EXEC sp_executeSQL as record set?

    Yes it will.

    with respect to performance it may different. but result will be same

  • RE: How show datetime select only in Sql Server?

    Try this one

    declare @emp table(EMPNo varchar(10),fullnam varchar(20))

    declare @tfile table(EMPNo varchar(10),CDate datetime,Ctime datetime)

    insert into @emp

    select * from

    (

    Values

    ('0001','xyz1'),

    ('0002','xyz2'),

    ('0003','xyz3'),

    ('0004','xyz4'),

    ('0005','xyz5')

    )a (no,name)

    insert into @tfile

    select * from

    (

    Values

    ('0001','10/29/2012','2012-10-29 07:52:00.000'),

    ('0001','10/29/2012','2012-10-29 19:00:00.000'),

    ('0002','10/29/2012','2012-10-29 07:40:00.000'),

    ('0002','10/29/2012','2012-10-29 19:32:00.000'),

    ('0005','10/29/2012','2012-10-29 07:58:00.000'),

    ('0005','10/29/2012','2012-10-29...

  • RE: create table variable dynamically

    To create Dynamic variable table

    declare @temptable table

    (

    id int identity(1,1),

    name varchar(50)

    )

    insert into @temptable

    select name from yourtable

  • RE: How do we calculate the Space used per row

    even for avg Data Size

    sp_spaceused TableName

    Output

    name rowsreserveddataindex_sizeunused

    TableName11 32 KB8...

  • RE: Need help for a Query

    If you using merge solution given by "Jason-299789 " then duplicate data will not going to come

    and if you want to delete duplicate record from same table

    then use simple row_number,or...

  • RE: Stored Procedures and updating multiple tables

    how about trigger on primary or on Child table base on your requirment.

    why you want to use foreign key?

    foreign key is for the relation and CONSTRAINT on table

  • RE: Parsing out email address in FROM field

    why cant go for simple replace

    declare @test-2 varchar(100)='<test@gmail.com>;<test1@gmail.com>'

    select REPLACE(replace(@test,'>',''),'<','')

    it does matter how many email in columns.

    what say?

  • RE: SQl Joins

    insert into A( id_a,b,c,id_m) values (1,2,3,(select id_m from B where id_m=5))

    This will work unless and until

    select id_m from B where id_m=5 return only one(return multiple value not allowed gives error)...

  • RE: SQl Joins

    I havent try that Sqllite db

    but if toy create table like

    CREATE TABLE test (ID INTEGER PRIMARY KEY AUTOINCREMENT,Othercol varchar(20))

    then try to remove AUTOINCREMENT from that and create table

  • RE: SQl Joins

    yes then go for Inner join and yes do Normalize you table ,

    Like companymaster,workregmaster,empmaster,addressmaster,workdetail

    just take care that data should not repeat in table ,it will affect size and performance.

    you will...

  • RE: SQl Joins

    yes create one more table

    1)WRegn Master where WRegnNum is PK having(WRegnNum PK,Wregname,Address_id,NumOfEmployees)

    2)Workplace (Workplacecode PK,WRegnNum,Empid)

    3)EmployeeMaster

    4)AddressMaster

    so Data will not repeat and save your size and everything

    now as far as...

  • RE: SQl Joins

    Is it what you want or just give me result which you want base on this data

    so that can give you query

    declare @workplace table(

    Workplacecode int...

  • RE: SQl Joins

    Okk now

    for 2nd Employee it would be

    Workplace code-2

    WRegNum-098-098 (Company reg Number) (It will be same )

    WorkplaceName- Oracle Inc

    NumOfEmplouees-1000

    EmpName - 'Bill' (I get emp name from Employee table using EmpNumber...

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