Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cwtriguns2002
Constraint Violating Yak Guru
272 Posts |
Posted - 2007-02-24 : 00:50:50
|
| Hello everyone. I have some sorts of question about queries. Here are they.1. Is it possible to make a query the returns the date/time today? If so, how to do it...2. I have a tablename 'customers', and i want to make a query that returns the number of fields. Any thoughts?3. How to make a query that forcely converts the field's datatype to another. (e.g. tablename 'customers', field 'custid' with datatype int) Is it possible to change the datatype of custid to string even it has hundreds of data? Thanks.-Ron- |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-02-24 : 01:17:38
|
1. getdate()2. select count(*) from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'customers'3. select convert(varchar(10), custid) from customersPlease refer to Books OnLine for further information KH |
 |
|
|
cwtriguns2002
Constraint Violating Yak Guru
272 Posts |
Posted - 2007-02-24 : 02:08:07
|
| thanks.How to delete rows in a table? I want to set my table 'customers' to empty. No rows at all.-Ron- |
 |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2007-02-24 : 02:48:35
|
from Query Analyzer typeTRUNCATE TABLE customers this will empty that table completely. make sure you have a backup before you do this because the data will really be gone. -ec |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2007-02-25 : 07:13:03
|
| If you want to completely empty the table then follow the EC Solutions, but if you want to delete the records on some condition then .. Delete From Table Where < your condition>Chiraghttp://chirikworld.blogspot.com/ |
 |
|
|
|
|
|