Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Showing results 1 to 25 of 95
Search took 0.01 seconds.
Search: Posts Made By: SqlMenace
Forum: SQL Server 2000 July 10th, 2006, 07:49 AM
Replies: 7
Views: 14,011
Posted By SqlMenace
One way select count(*) from table ...

One way

select count(*)
from table
where DateColumn between '20060701' and '20060831'
and datepart(dw,DateColumn) in (1,7)

------------------------------------------...
Forum: SQL Server 2000 June 28th, 2006, 08:27 AM
Replies: 4
Views: 23,853
Posted By SqlMenace
Another way using PARSENAME -- prepare test...

Another way using PARSENAME

-- prepare test data
declare @test table (Name varchar(200))

insert @test
select 'Smith, John T' union all
select 'Nguyen, Hung F' union all
select 'Johnson,...
Forum: SQL Server 2000 June 20th, 2006, 02:23 PM
Replies: 2
Views: 513
Posted By SqlMenace
it's easy, take away count run this SELECT 1...

it's easy, take away count
run this
SELECT 1 FROM Employees;
SELECT 4 FROM Employees;
SELECT 5 FROM Employees;
SELECT 100 FROM Employees;

as you can see the result is a bunch of numbers that...
Forum: SQL Server 2000 May 12th, 2006, 01:51 PM
Replies: 3
Views: 1,712
Posted By SqlMenace
That will work in SQL server 2005 but not in 2000...

That will work in SQL server 2005 but not in 2000
you can use SET ROWCOUNT in 2000

DECLARE @TopCount integer
SET ROWCOUNT 100

SELECT * FROM MyTable ORDER BY RecordDate

SET ROWCOUNT 0...
Forum: SQL Server 2000 March 20th, 2006, 03:43 PM
Replies: 1
Views: 11,388
Posted By SqlMenace
here is one way SELECT CATALOG_NAME AS...

here is one way

SELECT CATALOG_NAME AS DataBaseName
FROM INFORMATION_SCHEMA.SCHEMATA

and another

SELECT name AS DATABASENAME
FROM master.dbo.sysdatabases
Forum: SQL Server 2000 March 16th, 2006, 09:09 AM
Replies: 1
Views: 1,255
Posted By SqlMenace
It's in Books On Line DBCC SHOWCONTIG:Section...

It's in Books On Line
DBCC SHOWCONTIG:Section E


E. Use DBCC SHOWCONTIG and DBCC INDEXDEFRAG to defragment the indexes in a database
This example shows a simple way to defragment all indexes...
Forum: SQL Server 2000 March 15th, 2006, 05:05 PM
Replies: 1
Views: 1,492
Posted By SqlMenace
Take a look here ( ...

Take a look here ( http://sqlservercode.blogspot.com/2006/03/find-out-if-table-has-identity-column.html ) modify for your own use

------------------------------------------...
Forum: SQL Server 2000 March 15th, 2006, 05:04 PM
Replies: 2
Views: 1,197
Posted By SqlMenace
yep, right here ( ...

yep, right here ( http://sqlservercode.blogspot.com/2006/03/find-out-if-table-has-identity-column.html )

------------------------------------------ http://sqlservercode.blogspot.com/
Forum: SQL Server 2000 March 8th, 2006, 09:16 AM
Replies: 2
Views: 830
Posted By SqlMenace
insert into db1.dbo.table1 select * from ...

insert into db1.dbo.table1
select * from
db2.dbo.table1



------------------------------------------ http://sqlservercode.blogspot.com/
Forum: SQL Server 2000 March 7th, 2006, 09:51 AM
Replies: 2
Views: 958
Posted By SqlMenace
sure, take a look at...

sure, take a look at http://vyaskn.tripod.com/code.htm#inserts




------------------------------------------ http://sqlservercode.blogspot.com/
Forum: SQL Server 2000 March 7th, 2006, 09:30 AM
Replies: 2
Views: 962
Posted By SqlMenace
select coalesce(field,0) or select...

select coalesce(field,0) or
select isnull(field,0)



------------------------------------------ http://sqlservercode.blogspot.com/
Forum: SQL Server 2000 February 28th, 2006, 12:33 PM
Replies: 3
Views: 3,401
Posted By SqlMenace
you will have to use DTS for that ...

you will have to use DTS for that

------------------------------------------ http://sqlservercode.blogspot.com/
Forum: SQL Server 2000 February 28th, 2006, 12:19 PM
Replies: 3
Views: 3,401
Posted By SqlMenace
Hi, It should be Use Northwind GO insert...

Hi,
It should be
Use Northwind
GO
insert into Orders -- are you trying to insert into orders???
select OrderID, CustomerID from OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel...
Forum: SQL Language February 23rd, 2006, 09:09 AM
Replies: 2
Views: 3,365
Posted By SqlMenace
A couple of ways select month(getdate()) ...

A couple of ways

select month(getdate()) --2
select datepart(m,getdate()) --2
select datename(m,getdate()) --February
select month(CURRENT_TIMESTAMP) --2



“I sense many useless...
Forum: SQL Server 2000 February 21st, 2006, 10:46 AM
Replies: 2
Views: 850
Posted By SqlMenace
How about Update TABLE1 Set FIELD2 =...

How about

Update TABLE1
Set
FIELD2 = (SELECT TOP 1 FIELDB FROM TABLE2 WHERE (FIELDA= @PARAM1))
WHERE (FIELD1 = @PARAM1)



How do you know that that is the value that you want? do you have...
Forum: SQL Server 2000 February 16th, 2006, 02:25 PM
Replies: 2
Views: 17,807
Posted By SqlMenace
very easy, use the ANSI system views IF NOT...

very easy, use the ANSI system views
IF NOT EXISTS(
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='Timesheet'
AND COLUMN_NAME ='Approve')



“I sense many useless updates in...
Forum: SQL Language February 6th, 2006, 01:39 PM
Replies: 2
Views: 957
Posted By SqlMenace
yes you have to swith the field names and...

yes you have to swith the field names and parameters around

Update tblMoniesReceived
Set vchRoutingID = @RoutingID , vchEntryType =@Type etc etc etc

and then it will work



“I sense...
Forum: SQL Server 2000 February 1st, 2006, 09:31 AM
Replies: 6
Views: 1,077
Posted By SqlMenace
One way SELECT * FROM tblCompany WHERE COMPNAME...

One way
SELECT * FROM tblCompany WHERE COMPNAME = 'ALYSONS'' MERCHANDISE'

just double the single quote

Test it out

create table #test (COMPNAME varchar(50))
insert into #test
select...
Forum: SQL Server 2000 January 25th, 2006, 03:00 PM
Replies: 9
Views: 1,677
Posted By SqlMenace
are you doing count(*) or count(field) look...

are you doing count(*) or count(field)

look at this difference

CREATE TABLE testnulls (ID INT)
INSERT INTO testnulls VALUES (1)
INSERT INTO testnulls VALUES (2)
INSERT INTO testnulls VALUES...
Forum: SQL Server 2000 January 25th, 2006, 02:10 PM
Replies: 9
Views: 1,677
Posted By SqlMenace
Run DBCC UPDATEUSAGE and try again “I...

Run DBCC UPDATEUSAGE and try again

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation...
Forum: SQL Server 2000 January 24th, 2006, 11:02 AM
Replies: 6
Views: 1,630
Posted By SqlMenace
If you only care about times you can also do a...

If you only care about times you can also do a kludge like this

create table timespan(startime int,endtime int)
insert into timespan
select 1629 , 1630 union all
select 751 , 800 union...
Forum: SQL Server 2000 January 23rd, 2006, 10:15 PM
Replies: 4
Views: 27,465
Posted By SqlMenace
SELECT REPLACE(CONVERT(VARCHAR,GETDATE(),106),'...

SELECT REPLACE(CONVERT(VARCHAR,GETDATE(),106),' ','-')

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to...
Forum: SQL Server 2000 January 7th, 2006, 02:34 PM
Replies: 8
Views: 5,903
Posted By SqlMenace
Anantsharma, ASCII works only 1 character at a...

Anantsharma,
ASCII works only 1 character at a time meaning select ascii('ab'),ascii('ac') returns 97 in both cases, you would have to loop thru the whole string
And the ASCII character set only...
Forum: SQL Language January 6th, 2006, 02:59 PM
Replies: 5
Views: 16,671
Posted By SqlMenace
SELECT count (*) FROM SCHCVVVT.dbcYVAUTH01...

SELECT count (*)
FROM SCHCVVVT.dbcYVAUTH01 dbc1,
SCHCVVVT.dbcYVvVVT01 dbc,
SCHCVVVT.dbcYVACTV01 dbc2,
SCHCVVVT.dbcYVPROF01 dbc3
WHERE dbc1.AUTH_CLNT_IDNO=dbc.VVVT_CLNT_IDNO
AND ...
Forum: SQL Language January 6th, 2006, 02:31 PM
Replies: 5
Views: 16,671
Posted By SqlMenace
select count(*) from table1, table2, table3, ...

select count(*)
from table1, table2, table3,
where etc, etc, etc.)

example

select count(*) from employee e join address a on e.id =a.id
where zipcode = 10288

“I sense many useless...
Showing results 1 to 25 of 95

 




Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.