Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies®
by Robert D. Schneider, Darril Gibson
II.4.5. Creating a Table via SQLCMD
If you're old school, and prefer to use character-based utilities rather than these newfangled graphical management environments like the SQL Server Management Studio, Microsoft hasn't forgotten you. The SQLCMD utility allows you to interactively enter SQL statements or run a predefined SQL script.
Here's how to use this utility to create a new table:
Open a command prompt.
Choose Start
Run and entering cmd. Alternatively, you can choose Programs
Accessories
Command Prompt. When you see the friendly command prompt, it's time to launch SQLCMD.Enter SQLCMD at the command prompt, passing in the proper parameters.
This can get a bit confusing: SQLCMD is rather picky about the exact syntax that it deigns appropriate to run. This isn't surprising when you realize that it supports more than two dozen parameters. Table 4-2 highlights a small group of key parameters.
Table II.4-2. Key SQLCMD Parameters Parameter Purpose S Specify the server that you want to connect to U Provide your username P Provide your password D Which database to use (if any) I The SQL script file (if any) If you get in hot water, you can always ask SQLCMD for help:
SQLCMD /?
Enter your table creation SQL, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access