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
User Profile
Collapse
-
Hi,
In the Enterprise Manager
---------------------------------------
1.select database
2.Right click->View->taskpad
3.In Taskpad, select table info
Regards,
Ram ASPLeave a comment:
-
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.Leave a comment:
-
-
Hi,
Answer for your question
------------------------------------
select top 1 * from tablename order by column name descLeave 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 .....Leave a comment:
-
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 gsLeave a comment:
-
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....... ..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..........Leave a comment:
-
Please specify whether the trigger is for insert or update or delete
the error statement clearly........ .....Leave a comment:
-
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...Leave a comment:
-
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.Leave a comment:
-
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 spLeave 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.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.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.Leave a comment:
-
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.Leave a comment:
-
No activity results to display
Show More
Leave a comment: