Friday, March 9, 2012
DOS ODBC Driver
DOS? ie not from a DOS window, but from a system booted
into DOS 6.22?
Wanting to read a SQL or Access Database after making a
network connection from DOS.
Thanks,
Rob
There is not an ODBC driver for DOS.
Rand
This posting is provided "as is" with no warranties and confers no rights.
DOS ODBC Driver
DOS? ie not from a DOS window, but from a system booted
into DOS 6.22?
Wanting to read a SQL or Access Database after making a
network connection from DOS.
Thanks,
RobThere is not an ODBC driver for DOS.
Rand
This posting is provided "as is" with no warranties and confers no rights.
DOS dir command info in a table?
I am trying to capture all the infromation that DOS dir command
generates and stores it into a table called #DirectoryInfo. See below:
create table #DirectoryInfo (
dir varchar(255),
date datetime NULL,
size int,
name varchar(255),
type char(9))
insert #DirectoryInfo exec xp_cmdshell 'dir c:\MyDir\File1.txt'
I am getting this error message:
Server: Msg 213, Level 16, State 7, Procedure xp_cmdshell, Line 11
Insert Error: Column name or number of supplied values does not match
table definition.
what columns I am missing here? or am I am defining more columns than
expected? Thanks for your help.
This is what I get when I do a DIR command for c:\file1.txt
Volume in drive C is Dell Server
Volume Serial Number is XXXX-YYY
NULL
Directory of c:\MyDir
NULL
10/18/2005 10:05a 4 File1.txt
1 File(s) 4 bytes
0 Dir(s) 10,569,293,824 bytes free
Any help would be appreciated! Thanks!
*** Sent via Developersdex http://www.examnotes.net ***xp_cmdshell returns data in a single nvarchar(255) column. (see BOL
entry for more details)
Test Test wrote:
>Hello!
>I am trying to capture all the infromation that DOS dir command
>generates and stores it into a table called #DirectoryInfo. See below:
>create table #DirectoryInfo (
>dir varchar(255),
>date datetime NULL,
>size int,
>name varchar(255),
>type char(9))
>insert #DirectoryInfo exec xp_cmdshell 'dir c:\MyDir\File1.txt'
>I am getting this error message:
>Server: Msg 213, Level 16, State 7, Procedure xp_cmdshell, Line 11
>Insert Error: Column name or number of supplied values does not match
>table definition.
>what columns I am missing here? or am I am defining more columns than
>expected? Thanks for your help.
>This is what I get when I do a DIR command for c:\file1.txt
>
> Volume in drive C is Dell Server
> Volume Serial Number is XXXX-YYY
>NULL
> Directory of c:\MyDir
>NULL
>10/18/2005 10:05a 4 File1.txt
> 1 File(s) 4 bytes
> 0 Dir(s) 10,569,293,824 bytes free
>
>Any help would be appreciated! Thanks!
>
>*** Sent via Developersdex http://www.examnotes.net ***
>|||Try:
CREATE TABLE DIR
(DIRCOL NVARCHAR(255))
GO
INSERT DIR
EXEC MASTER..XP_CMDSHELL 'DIR C:'
GO
SELECT DIRCOL FROM DIR
HTH
Jerry
"Test Test" <farooqhs_2000@.yahoo.com> wrote in message
news:O7yrk1O1FHA.3256@.TK2MSFTNGP09.phx.gbl...
> Hello!
> I am trying to capture all the infromation that DOS dir command
> generates and stores it into a table called #DirectoryInfo. See below:
> create table #DirectoryInfo (
> dir varchar(255),
> date datetime NULL,
> size int,
> name varchar(255),
> type char(9))
> insert #DirectoryInfo exec xp_cmdshell 'dir c:\MyDir\File1.txt'
> I am getting this error message:
> Server: Msg 213, Level 16, State 7, Procedure xp_cmdshell, Line 11
> Insert Error: Column name or number of supplied values does not match
> table definition.
> what columns I am missing here? or am I am defining more columns than
> expected? Thanks for your help.
> This is what I get when I do a DIR command for c:\file1.txt
>
> Volume in drive C is Dell Server
> Volume Serial Number is XXXX-YYY
> NULL
> Directory of c:\MyDir
> NULL
> 10/18/2005 10:05a 4 File1.txt
> 1 File(s) 4 bytes
> 0 Dir(s) 10,569,293,824 bytes free
>
> Any help would be appreciated! Thanks!
>
> *** Sent via Developersdex http://www.examnotes.net ***|||Thanks Jerry but I was hoping to store information (filename, extension,
size, datetime) in separte columns. What I need is FileName and FileSize
information. How do I get it? Should I extract it from DIRCOL from DIR
table? How?
*** Sent via Developersdex http://www.examnotes.net ***|||You could probably grab some of that information by using the undocumented
extended stored procedures in SQL Server however I'd probably use some other
method i.e., VBScript -->WSH --> SQL Table.
HTH
Jerry
"Test Test" <farooqhs_2000@.yahoo.com> wrote in message
news:%23zALTUP1FHA.3504@.TK2MSFTNGP10.phx.gbl...
> Thanks Jerry but I was hoping to store information (filename, extension,
> size, datetime) in separte columns. What I need is FileName and FileSize
> information. How do I get it? Should I extract it from DIRCOL from DIR
> table? How?
>
>
>
> *** Sent via Developersdex http://www.examnotes.net ***|||There is an example in this article that does almost exactly what you
are asking, I think:
http://users.drew.edu/skass/sql/TextDriver.htm
Steve Kass
Drew University
Test Test wrote:
>Hello!
>I am trying to capture all the infromation that DOS dir command
>generates and stores it into a table called #DirectoryInfo. See below:
>create table #DirectoryInfo (
>dir varchar(255),
>date datetime NULL,
>size int,
>name varchar(255),
>type char(9))
>insert #DirectoryInfo exec xp_cmdshell 'dir c:\MyDir\File1.txt'
>I am getting this error message:
>Server: Msg 213, Level 16, State 7, Procedure xp_cmdshell, Line 11
>Insert Error: Column name or number of supplied values does not match
>table definition.
>what columns I am missing here? or am I am defining more columns than
>expected? Thanks for your help.
>This is what I get when I do a DIR command for c:\file1.txt
>
> Volume in drive C is Dell Server
> Volume Serial Number is XXXX-YYY
>NULL
> Directory of c:\MyDir
>NULL
>10/18/2005 10:05a 4 File1.txt
> 1 File(s) 4 bytes
> 0 Dir(s) 10,569,293,824 bytes free
>
>Any help would be appreciated! Thanks!
>
>*** Sent via Developersdex http://www.examnotes.net ***
>
Dos commands within a stored procedure
Cd\fred
Delete *.*
Thanks in advace for your assistance...use osql.
Mel|||Yes, though xp_cmdshell. Bu carefully consider the security implications.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
news:98BB887A-EDD1-4D08-966D-2938733502FD@.microsoft.com...
> Can I issue a dos command like
> Cd\fred
> Delete *.*
> Thanks in advace for your assistance...|||Hi Jim!
Don't forget that xp_cmdshell is disabled in SQL 2005 by default if that's
your platform. You'll need to enable it using the SQL Server Service Surface
Configuration Manager. And your DBA is gonna give you hell for doing so :-)
BTW, you would probably want to do a
del C:\fred\*.*
to chain the commands. And if you run a command shell like 4NT that aliases
commands like del, you may have to make it
*del C:\fred\*.*
Regards,
Jan
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OpneAAZWGHA.3328@.TK2MSFTNGP02.phx.gbl...
> Yes, though xp_cmdshell. Bu carefully consider the security implications.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
> news:98BB887A-EDD1-4D08-966D-2938733502FD@.microsoft.com...
>
Dos commands within a stored procedure
Cd\fred
Delete *.*
Thanks in advace for your assistance...
use osql.
Mel
|||Yes, though xp_cmdshell. Bu carefully consider the security implications.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
news:98BB887A-EDD1-4D08-966D-2938733502FD@.microsoft.com...
> Can I issue a dos command like
> Cd\fred
> Delete *.*
> Thanks in advace for your assistance...
|||Hi Jim!
Don't forget that xp_cmdshell is disabled in SQL 2005 by default if that's
your platform. You'll need to enable it using the SQL Server Service Surface
Configuration Manager. And your DBA is gonna give you hell for doing so :-)
BTW, you would probably want to do a
del C:\fred\*.*
to chain the commands. And if you run a command shell like 4NT that aliases
commands like del, you may have to make it
*del C:\fred\*.*
Regards,
Jan
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OpneAAZWGHA.3328@.TK2MSFTNGP02.phx.gbl...
> Yes, though xp_cmdshell. Bu carefully consider the security implications.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
> news:98BB887A-EDD1-4D08-966D-2938733502FD@.microsoft.com...
>
Dos commands within a stored procedure
Cd\fred
Delete *.*
Thanks in advace for your assistance...use osql.
Mel|||Yes, though xp_cmdshell. Bu carefully consider the security implications.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
news:98BB887A-EDD1-4D08-966D-2938733502FD@.microsoft.com...
> Can I issue a dos command like
> Cd\fred
> Delete *.*
> Thanks in advace for your assistance...|||Hi Jim!
Don't forget that xp_cmdshell is disabled in SQL 2005 by default if that's
your platform. You'll need to enable it using the SQL Server Service Surface
Configuration Manager. And your DBA is gonna give you hell for doing so :-)
BTW, you would probably want to do a
del C:\fred\*.*
to chain the commands. And if you run a command shell like 4NT that aliases
commands like del, you may have to make it
*del C:\fred\*.*
Regards,
Jan
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OpneAAZWGHA.3328@.TK2MSFTNGP02.phx.gbl...
> Yes, though xp_cmdshell. Bu carefully consider the security implications.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
> news:98BB887A-EDD1-4D08-966D-2938733502FD@.microsoft.com...
>> Can I issue a dos command like
>> Cd\fred
>> Delete *.*
>> Thanks in advace for your assistance...
>
dos command to copy between 2 domains
i think it is something like so ...
copy C:\PathToMySQLServer\MSSQL.1\MSSQL\Backup\ReportSe rver\* remote_host=\\10.0.0.0\backup" myusername@.mydomain.com;mypasswordare the ip addresses known to each other. You could invoke robocopy from the cmd line. robocopy is a m$oft tool ... http://www.microsoft.com/technet/technetmag/issues/2006/11/UtilitySpotlight/|||yeah i just talked that over with the boss.|||My first thought would have been to try to use the runas command, but I have never tried it for this sort of thing.
Dos and Donts of SQL
"expert" about how a table was poorly designed has piqued my interest.
The question is this. What are the do's and don'ts of sql development?
Please list what you consider to be good and bad practices in general
and/or specific or list links to resources that would be considered
under this topic.
When I consider best practices myself of course there is always the
standards of 3nf and such but what about when it comes to standard
table structures and field sizes for say a Name (first, last, etc) and
contacts table. What about naming conventions and common entities and
structures.
It seems to me that every SQL Developer that enters this field starts
out with the basics of how the technology works and a little of the
practices. Yet from there I see many different directions that they
go.
To start this conversation out let me propose some things that I have
questions about. Feel free to expand and add to this list.
1. What would you consider the standard/best way to represent a
gender.
2. Field Size for Names and address First/Last Etc.
3. Include or don't include City/State in an address/contact list.
4. Structure of a Generic Contact list.
5. Practices for dealing with pictures and documents as well as
related table structures.
6. Level of normalization to aim for. (My minimum is 3 but I
generally hit Boyce Codd myself)
7. What datatypes to avoid and why.
Two requests.
1. Keep it polite.
2. Be constructive and complete.Just as I was posting this I saw a link to a fine articles on the best
practices. Here it is
http://vyaskn.tripod.com/coding_conventions.htm|||Want to wait a bit for my next book, SQL PROGRAMMING STYLE to come out?
1. What would you consider the standard/best way to represent a
gender. Use the ISO codes, since they are standards, of course.
2. Field [sic] Size for Names and address First/Last Etc. Use the USPS
model, which is based on a five line, 3.5 inch label with 10 pitch type
on it.
3. Include or don't include City/State in an address/contact list.
Include it since you need it to mail anything.
4. Structure of a Generic Contact list. Unh? That is not a question.
5. Practices for dealing with pictures and documents as well as
related table structures. Use tools intended for them. There are
several good textbases. I have not worked with graphic search tools.
6. Level of normalization to aim for. (My minimum is 3 but I
generally hit Boyce Codd myself) if you use an ORM model instead of
ER, you will get to 5NF.
7. What datatypes to avoid and why. Anything proprietary because it
will not port, cannot be guaranteed to be consistent from one release
to the next, etc.|||Well CELKO said me a copy to review and I'll be happy to read it :)
However many people's first target for questions and advise is the
internet and usegroups like this.
This is a resource that we need to continue to support and add to.
Since it is a resouce for all of us. Not just those with a specific
book on their shelf. (not to down play your book which I actually may
go get or look at after it's published) Good luck with the book in the
meantime.|||I had a comment on the normalization. We have a reporting database that is
updated nightly. It runs on a little server for only management accesses.
If I normalized this database, reports would run 10 minutes. I normally
build non-normalized tables for the reports and they run in a couple of
seconds. Therefore, my point is normalization really depends on the desired
application.
"Dan Gidman" <danatcofo@.gmail.com> wrote in message
news:1113403304.346956.186420@.g14g2000cwa.googlegr oups.com...
> Well guys this may be the wrong place but an earlier post by an
> "expert" about how a table was poorly designed has piqued my interest.
> The question is this. What are the do's and don'ts of sql development?
> Please list what you consider to be good and bad practices in general
> and/or specific or list links to resources that would be considered
> under this topic.
> When I consider best practices myself of course there is always the
> standards of 3nf and such but what about when it comes to standard
> table structures and field sizes for say a Name (first, last, etc) and
> contacts table. What about naming conventions and common entities and
> structures.
> It seems to me that every SQL Developer that enters this field starts
> out with the basics of how the technology works and a little of the
> practices. Yet from there I see many different directions that they
> go.
> To start this conversation out let me propose some things that I have
> questions about. Feel free to expand and add to this list.
> 1. What would you consider the standard/best way to represent a
> gender.
> 2. Field Size for Names and address First/Last Etc.
> 3. Include or don't include City/State in an address/contact list.
> 4. Structure of a Generic Contact list.
> 5. Practices for dealing with pictures and documents as well as
> related table structures.
> 6. Level of normalization to aim for. (My minimum is 3 but I
> generally hit Boyce Codd myself)
> 7. What datatypes to avoid and why.
> Two requests.
> 1. Keep it polite.
> 2. Be constructive and complete.|||>> I normally build non-normalized tables for the reports .. <<
This is a "Data Warehouse" versus "OLTP database"; you can do this only
because the warehouse is loaded from a normalized production database
and then is never updated while in use. A data warehouse is a very
different game. Even teh quereis are different.