Hi All,
I need to make a query from the SQL Server 2K and save this data as an XML file. What i am trying to do is to execute a bcp utility as follows:
EXEC master..xp_cmdshell 'bcp "SELECT CustID,CustName,CustSurname,CustEmail FROM myOwenDB..T_Customers FOR XML RAW" queryout "c:\customers.xml" -fc:\bcp.fmt -Sservername -Usa -Ppwd -C RAW -r -t'
with bcp.fmt file formatted as
8.0
4
1 SQLCHAR 0 9 "\t" 1 CustID Turkish_CI_AS
2 SQLCHAR 0 100 "\t" 2 CustName Turkish_CI_AS
3 SQLCHAR 0 100 "\t" 3 CustSurname Turkish_CI_AS
4 SQLCHAR 0 100 "\t" 4 CustEmail Turkish_CI_AS
The error is as follows:
Error = [Microsoft][ODBC SQL Server Driver]Host-file columns may be skipped only when copying into the Server
Does anyone have an idea about the problem? Also other techniques to generate XML file are also welcomed:)
Thanks in advance,
Bahtiyar KARANLIKYour select statment only returns one column and you are using a format file that says bcp will be receiving four columns from the select statment.|||Hi,
How can my SQL statement can return only one column? When i execute the statement via Query Analyzer it displays the correct information?
Am i missing a point??
Bahtiyar KARANLIK|||If you execute
SELECT CustID,CustName,CustSurname,CustEmail FROM myOwenDB..T_Customers
In QA you will get four columns, CustID, CustName,CustSurname and CustEmail.
If you execute
SELECT CustID,CustName,CustSurname,CustEmail FROM myOwenDB..T_Customers FOR XML RAW
In QA you will have a resultset with one column. Within the one column you will have an XML string that contains the four above mentioned columns, but they will be contained in one column!
If you execute
select au_id,au_lname,phone,contract from pubs.dbo.authors
you should get something like:
au_id au_lname phone contract
---- ------------ ---- ---
172-32-1176 White 408 496-7223 1
If you execute
select au_id,au_lname,phone,contract from pubsdbo.authors for xml raw
you should get something like:
XML_F52E2B61-18A1-11d1-B105-00805F49916B
------------------------
<row au_id="172-32-1176" au_lname="White" phone="408 496-7223" contract="1"/>
The first has four colums in the result set the second has only one.
Showing posts with label skipped. Show all posts
Showing posts with label skipped. Show all posts
Sunday, February 26, 2012
Wednesday, February 15, 2012
Erro Mssage: tempdb is skipped. You cannot run a query that requires tempdb
While access a view (which is described as following), I encountered the
following error message:
tempdb is skipped. You cannot run a query that requires
tempdb
After I reboot the database, the error goes away.
What cauases this error, and how can I fix it?
Thanks.
-- Charlie Lu
=========================================== View:
SELECT USERTBL.name AS User_Name
,ROLETBL.name AS Role_Name
,RM.Is_Primary
FROM sysusers USERTBL
INNER JOIN sysmembers SM
ON USERTBL.uid = SM.memberuid
INNER JOIN sysusers ROLETBL
ON SM.groupuid = ROLETBL.uid
INNER JOIN ROLE_MAP RM
ON ROLETBL.name = RM.Role_NameI can't get that far to try and reproduce, because I get:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'ROLE_MAP'.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"C. Ming Lu" <cminglu@.qmxs.com> wrote in message
news:eDVWJVdaEHA.556@.tk2msftngp13.phx.gbl...
> While access a view (which is described as following), I encountered the
> following error message:
> tempdb is skipped. You cannot run a query that requires
> tempdb
> After I reboot the database, the error goes away.
> What cauases this error, and how can I fix it?
> Thanks.
> -- Charlie Lu
> ===========================================> View:
> SELECT USERTBL.name AS User_Name
> ,ROLETBL.name AS Role_Name
> ,RM.Is_Primary
> FROM sysusers USERTBL
> INNER JOIN sysmembers SM
> ON USERTBL.uid = SM.memberuid
> INNER JOIN sysusers ROLETBL
> ON SM.groupuid = ROLETBL.uid
> INNER JOIN ROLE_MAP RM
> ON ROLETBL.name = RM.Role_Name
>|||Sorry about the , I cut it out of the view. Role_Map is the user defined
table.
Here is the selection statement.
SELECT USERTBL.name AS User_Name
,ROLETBL.name AS Role_Name
FROM sysusers USERTBL
INNER JOIN sysmembers SM
ON USERTBL.uid = SM.memberuid
INNER JOIN sysusers ROLETBL
ON SM.groupuid = ROLETBL.uid
Regards,
-- C. Ming Lu
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:u$$GozdaEHA.2840@.TK2MSFTNGP11.phx.gbl...
> I can't get that far to try and reproduce, because I get:
> Server: Msg 208, Level 16, State 1, Line 1
> Invalid object name 'ROLE_MAP'.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "C. Ming Lu" <cminglu@.qmxs.com> wrote in message
> news:eDVWJVdaEHA.556@.tk2msftngp13.phx.gbl...
> > While access a view (which is described as following), I encountered the
> > following error message:
> > tempdb is skipped. You cannot run a query that requires
> > tempdb
> > After I reboot the database, the error goes away.
> >
> > What cauases this error, and how can I fix it?
> >
> > Thanks.
> >
> > -- Charlie Lu
> > ===========================================> > View:
> > SELECT USERTBL.name AS User_Name
> > ,ROLETBL.name AS Role_Name
> > ,RM.Is_Primary
> > FROM sysusers USERTBL
> > INNER JOIN sysmembers SM
> > ON USERTBL.uid = SM.memberuid
> > INNER JOIN sysusers ROLETBL
> > ON SM.groupuid = ROLETBL.uid
> > INNER JOIN ROLE_MAP RM
> > ON ROLETBL.name = RM.Role_Name
> >
> >
>
following error message:
tempdb is skipped. You cannot run a query that requires
tempdb
After I reboot the database, the error goes away.
What cauases this error, and how can I fix it?
Thanks.
-- Charlie Lu
=========================================== View:
SELECT USERTBL.name AS User_Name
,ROLETBL.name AS Role_Name
,RM.Is_Primary
FROM sysusers USERTBL
INNER JOIN sysmembers SM
ON USERTBL.uid = SM.memberuid
INNER JOIN sysusers ROLETBL
ON SM.groupuid = ROLETBL.uid
INNER JOIN ROLE_MAP RM
ON ROLETBL.name = RM.Role_NameI can't get that far to try and reproduce, because I get:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'ROLE_MAP'.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"C. Ming Lu" <cminglu@.qmxs.com> wrote in message
news:eDVWJVdaEHA.556@.tk2msftngp13.phx.gbl...
> While access a view (which is described as following), I encountered the
> following error message:
> tempdb is skipped. You cannot run a query that requires
> tempdb
> After I reboot the database, the error goes away.
> What cauases this error, and how can I fix it?
> Thanks.
> -- Charlie Lu
> ===========================================> View:
> SELECT USERTBL.name AS User_Name
> ,ROLETBL.name AS Role_Name
> ,RM.Is_Primary
> FROM sysusers USERTBL
> INNER JOIN sysmembers SM
> ON USERTBL.uid = SM.memberuid
> INNER JOIN sysusers ROLETBL
> ON SM.groupuid = ROLETBL.uid
> INNER JOIN ROLE_MAP RM
> ON ROLETBL.name = RM.Role_Name
>|||Sorry about the , I cut it out of the view. Role_Map is the user defined
table.
Here is the selection statement.
SELECT USERTBL.name AS User_Name
,ROLETBL.name AS Role_Name
FROM sysusers USERTBL
INNER JOIN sysmembers SM
ON USERTBL.uid = SM.memberuid
INNER JOIN sysusers ROLETBL
ON SM.groupuid = ROLETBL.uid
Regards,
-- C. Ming Lu
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:u$$GozdaEHA.2840@.TK2MSFTNGP11.phx.gbl...
> I can't get that far to try and reproduce, because I get:
> Server: Msg 208, Level 16, State 1, Line 1
> Invalid object name 'ROLE_MAP'.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "C. Ming Lu" <cminglu@.qmxs.com> wrote in message
> news:eDVWJVdaEHA.556@.tk2msftngp13.phx.gbl...
> > While access a view (which is described as following), I encountered the
> > following error message:
> > tempdb is skipped. You cannot run a query that requires
> > tempdb
> > After I reboot the database, the error goes away.
> >
> > What cauases this error, and how can I fix it?
> >
> > Thanks.
> >
> > -- Charlie Lu
> > ===========================================> > View:
> > SELECT USERTBL.name AS User_Name
> > ,ROLETBL.name AS Role_Name
> > ,RM.Is_Primary
> > FROM sysusers USERTBL
> > INNER JOIN sysmembers SM
> > ON USERTBL.uid = SM.memberuid
> > INNER JOIN sysusers ROLETBL
> > ON SM.groupuid = ROLETBL.uid
> > INNER JOIN ROLE_MAP RM
> > ON ROLETBL.name = RM.Role_Name
> >
> >
>
Subscribe to:
Posts (Atom)