Forum Replies Created

Viewing 15 posts - 1 through 15 (of 22 total)

  • RE: How to know when a field has been modified in the table

    In this case it is always better to add new datetime field in the table with default value getdate()

  • RE: LDF file growing

    First take full backup of the database

    then use following command

    DBCC SHRINKDATABASE('dbname',10,TRUNCATEONLY)

    or

    BACKUP LOG dbname WITH TRUNCATE_ONLY

  • RE: Number to date conversion (hour:Minutes:Sec)

    You need to use function to get field in hh:mm format

    function D_Time (@S_Time as int)

    as

    begin

    DECLARE @STR INT

    DECLARE @QRY VARCHAR(10)

    SET @STR=@S_Time

    SET @QRY=CAST(@STR/3600 AS VARCHAR(2))+':'

    SET @STR=@STR%3600

    SET...

  • RE: Table load

    Have u tried Union instead of Union All

  • RE: SQL query problem

    if your parameter is not fixed i.e. if value which you are comparing may contain Single Quotation mark or may not.. in that case before comparing first check for Single...

  • RE: DELETE duplicate records - need a simpler Solution

    There is proper solution for such kind of problem on microsoft site..just go in support.microsoft.com

    Simple way you can do like this

    select distinct EmpName,EmpDesignation

    into table2 from table1

    then drop table1 and rename...

  • RE: Avoiding Subquery in UPDATE

    Thanx Sergiy for clearing me

  • RE: Avoiding Subquery in UPDATE

    Sergiy , your first Query and My Query is almost same only difference is you have added alias and use that Alias in update statement.

    Tell me performance wise is...

  • RE: Avoiding Subquery in UPDATE

    Join is always faster compare to use of any sub query.

    And about second quote... I don't think so that you can update multiple table in single Query

  • RE: Avoiding Subquery in UPDATE

    UPDATE TableA

    Set ColumnA = 'Test'

    from TableA join TableB on

    TableA .ColumnB = TableB.ColumnC

    WHERE TableB.ColumnD = @Name

    I think this Query should work for you

  • RE: how to get default date

    from_date=year(getdate())+'-'+month(getdate())+'-'+'1'

    OR

    SELECT from_date=DATEADD(d,-(DAY(GETDATE())-1),GETDATE())

    to_date=DATEADD(d,-DAY(GETDATE()),DATEADD(m,1,GETDATE()))

  • RE: Need help with PIVOT

    You can not get in single query. but you can use bunch of statement

    copy following code in Query analyser

    DECLARE @S1 AS VARCHAR(400)

    SET @S1=''

    SELECT @S1 = @S1+', ' + [field1]...

  • RE: Dividing int columns

    modify command like this

    SET FldA = cast(FldB as float)/cast(FldC as float)

  • RE: NT4 and Sql 7

    At least you should have sa login to add this account. if you have then go in enterprise manager with sa login

    there you add new user. select build in administrator...

  • RE: Path of INI file

    always better to keep ini file at he place where exe file is there or in some folder so if you are using any front end application like vb then...

Viewing 15 posts - 1 through 15 (of 22 total)