Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Column name or number of supplied values? Expand / Collapse
Author
Message
Posted Thursday, April 4, 2013 6:59 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 7:11 AM
Points: 1,044, Visits: 2,930
Hi,

what is wrong in my coding? I want monitor some time interval for IO pending task witing in queue..

Error:
Msg 213, Level 16, State 1, Line 1
Column name or number of supplied values does not match table definition.

create table PendingIO (
[database] varchar (100),
Physical_name varchar (100),
io_pending int,
io_pending_ms_ticks int,
io_type varchar (20),
num_of_reads int,
num_of_writes int, time_stamp datetime default getdate())

insert into PendingIO values (
'[database]',
'Physical_name',
'io_pending',
'io_pending_ms_ticks',
'io_type',
'num_of_reads',
'num_of_writes')
SELECT DB_NAME(mf.database_id) AS [Database] , mf.physical_name ,
r.io_pending , r.io_pending_ms_ticks , r.io_type , fs.num_of_reads ,
fs.num_of_writes FROM sys.dm_io_pending_io_requests AS r INNER JOIN
sys.dm_io_virtual_file_stats(NULL, NULL) AS fs
ON r.io_handle = fs.file_handle INNER JOIN
sys.master_files AS mf ON fs.database_id = mf.database_id
AND fs.file_id = mf.file_id ORDER BY r.io_pending , r.io_pending_ms_ticks DESC ;

thanks
ananda
Post #1438767
Posted Thursday, April 4, 2013 7:05 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:55 AM
Points: 12,881, Visits: 31,817
there's a VALUES command hanging out there, and the column names should not be in single quotes;
create table PendingIO (
[database] varchar (100),
Physical_name varchar (100),
io_pending int,
io_pending_ms_ticks int,
io_type varchar (20),
num_of_reads int,
num_of_writes int,
time_stamp datetime default getdate())

INSERT INTO PendingIO ( [database],Physical_name,io_pending,io_pending_ms_ticks,io_type,num_of_reads,num_of_writes)
SELECT
DB_NAME(mf.database_id) AS [Database],
mf.physical_name,
r.io_pending,
r.io_pending_ms_ticks,
r.io_type,
fs.num_of_reads,
fs.num_of_writes
FROM sys.dm_io_pending_io_requests AS r
INNER JOIN sys.DM_IO_VIRTUAL_FILE_STATS(NULL, NULL) AS fs
ON r.io_handle = fs.file_handle
INNER JOIN sys.master_files AS mf
ON fs.database_id = mf.database_id
AND fs.file_id = mf.file_id
ORDER BY
r.io_pending,
r.io_pending_ms_ticks DESC;




Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1438776
Posted Thursday, April 4, 2013 7:09 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 8:42 PM
Points: 23,009, Visits: 31,510
Try this:


insert into PendingIO(
[database],
Physical_name,
io_pending,
io_pending_ms_ticks,
io_type,
num_of_reads,
num_of_writes
)
SELECT
DB_NAME(mf.database_id) AS [Database],
mf.physical_name ,
r.io_pending,
r.io_pending_ms_ticks,
r.io_type,
fs.num_of_reads,
fs.num_of_writes
FROM
sys.dm_io_pending_io_requests AS r
INNER JOIN sys.dm_io_virtual_file_stats(NULL, NULL) AS fs
ON r.io_handle = fs.file_handle
INNER JOIN sys.master_files AS mf
ON fs.database_id = mf.database_id
AND fs.file_id = mf.file_id
ORDER BY
r.io_pending,
r.io_pending_ms_ticks DESC;





Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1438779
Posted Thursday, April 4, 2013 10:35 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 7:11 AM
Points: 1,044, Visits: 2,930
yes.. it is working, thanks

what is the best intervel time configure at scheduling job for monitoring IO usages?

Thanks
ananda

Post #1439089
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse