User Profile

Collapse

Profile Sidebar

Collapse
ramasp
ramasp
Last Activity: Sep 23 '06, 09:14 AM
Joined: Sep 4 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • ramasp
    replied to time stamp data type
    Hi,
    Answer is
    --------------
    select convert(varchar ,getdate(),114)

    select convert(varchar ,ts,114) from tablename

    Here ts is the column name and its datatype is datetime

    Regards
    Ram ASP
    See more | Go to post

    Leave a comment:


  • Hi,

    In the Enterprise Manager
    ---------------------------------------
    1.select database
    2.Right click->View->taskpad
    3.In Taskpad, select table info

    Regards,
    Ram ASP
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to xp_cmdshell problem
    Hi,

    if you want to see the directories in a server then the folllowing is the command
    exec master.dbo.xp_c mdshell 'dir'

    you can use all dos commands here. if you are connected to a server, then u will get the details of server, otherwise u will get the details of local machine.
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to Go to the last record
    Hi,
    select top 1 * from tablename order by column name desc
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to last record in table
    Hi,
    Answer for your question
    ------------------------------------
    select top 1 * from tablename order by column name desc
    See more | Go to post

    Leave a comment:


  • select * from sysobjects where xtype='u'

    The above command displays user tables. Get each user table name from sysobjects by using cursor or while loop pass the same as input parameter ot the sp_changedbowne r

    Try .....
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to ldf & mdf
    mdf is the extension of primary file.
    ldf is the extension of transaction log file.
    whenever u create a database, u have to name the above fiels.
    Generally their location path is c:\programfiles \microsoft sql server\mssql\lo gs
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to DTS From SQL Server 2000 to Btrieve
    use the following function

    ltrim(replace(c olumnname,'''', ''))

    you are replacing a single quote in a column with a null and you trimming that with ltrim function....... ..
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to Distinct
    use convert function of sql server
    See more | Go to post

    Leave a comment:


  • without using trigger
    -------------------------------
    1. You can choose ondelete cascade option in design mode of the table.
    whenever u delete a record from table a the corresponding record from the table b will be deleted

    using trigger
    -------------------
    create a for delete trigger on table a.

    delete from b where channel id..........
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to Trigger problem in SQL
    Please specify whether the trigger is for insert or update or delete
    the error statement clearly........ .....
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to foreign key
    1. You can foreign keys.

    or

    2. You can check through code. By using Inner join table name
    on parenttabel.fie ld=childtable.f ield

    ro

    3.Before inserting a record in child table, check whether it exists in the parent table through code by using if exists or if (select count(*) from tablename where
    ....)=0

    or

    if exists(select 1 from tablename where...
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to Basic TSQL - DISTINCT in PK
    For example, if you have purchased 3 products from super market, the orderid is same for al the products. Look at the orderdetail table in nothwind database. The product id is different. Use sp_help orderdetails command to see the keys on the table. Composite primary key can be defined on two or more columns.
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to primary key
    It is a good practice to increment primary key column automatically. If the first row is null or 0 set to 1 else increment by using max(column) + 1
    in the insert sp
    See more | Go to post

    Leave a comment:


  • The following are the steps to be followd.

    1.copy the data from the existing excel sheet to a new excel sheet and save it.
    2. Use DTS service and transfer data to a sql server table. For example the table is created with name like sheet1$. Just rename it and change the datatypes of columns in the design mode as you like.
    3.when ever you change data from excel to a table, if you get error simple follow the 1 step.
    See more | Go to post

    Leave a comment:


  • If you want tables with relationships and data, take a complete back up of the database. Use that backup file and restore in sql 2005.
    See more | Go to post

    Leave a comment:


  • To maintain existing relationships, simply select all tables and copy them to a notepad. From there you just copy and paste them in the query anlyzer.
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to rowid is there?
    Add a column of int datatype to the existing table. Define identity on that column. Define Identity seed and identity increment as 1,1.
    The following is the syntax.

    a int identity(1,1). Here a is the column. SQL Server automatically increments the number. Based on that number you can fetch the desired record.
    See more | Go to post

    Leave a comment:


  • ramasp
    replied to rowid is there?
    select top 1 * from tablename...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...