Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Column name or number of supplied values?


Column name or number of supplied values?

Author
Message
SQL Galaxy
SQL Galaxy
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1220 Visits: 3465
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
Lowell
Lowell
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14984 Visits: 39008
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24278 Visits: 37987
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;




Cool
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)
SQL Galaxy
SQL Galaxy
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1220 Visits: 3465
yes.. it is working, thanks

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

Thanks
ananda
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search