If you were trying to create a SQL Server Agent job for the first time, but a message popped up that confused you, read on.
Continue readingHow to Enable the SQL Server Agent XPs using T-SQL
If you’re creating a SQL Server Agent job for the first time, you might find that you need to enable the SQL Server Agent extended stored procedures (SQL Server Agent XPs) first.
When you use the SQL Server Management Studio (SSMS) tool to start the SQL Server Agent service, these extended stored procedures are enabled automatically.
When you use T-SQL, you can enable the SQL Server Agent XPs with the sp_configure
stored procedure.
SQL Server Error 206: Operand type clash
SQL Server error Msg 206, Level 16 is a common error to get when inserting data into a table.
It happens when you’re trying to insert data into a column that is incompatible with the data type you’re trying to insert.
This could happen if you accidentally try to insert data into the wrong column (or even the wrong table). But it could also happen if you incorrectly assume that SQL Server will convert the data for you.
To fix this issue, make sure you’re inserting the correct data type.
Continue readingSQL Reference for Beginners
This page contains direct links to SQL tutorials and reference articles for beginners.
Continue readingHow to Map Multiple Partitions to a Single Filegroup in SQL Server (T-SQL)
If you’re familiar with creating partitioned tables in SQL Server, you might be used to creating a separate filegroup for each partition. This has its benefits, and may very well be the method you would choose in most scenarios.
However, you also have the option of mapping multiple partitions to a single filegroup.
In this article I share two examples of mapping multiple partitions to a single filegroup.
- Example 1 maps all partitions to a single filegroup.
- Example 2 maps some partitions to one filegroup, and some to another.
How to Rename a Table in SQL
In SQL, most RDBMSs allow you to rename a table using the ALTER TABLE
statement, which is the statement used to modify the definition of an existing table.
Some RDBMs also include a RENAME
statement for renaming tables.
But if you use SQL Server, you’ll need to use the sp_rename
stored procedure.
SQL DROP TABLE for Beginners
In SQL, if you want to remove a table from a database, you need to use the DROP TABLE
statement.
That destroys the table and all its data.
Continue readingHow to Drop a Foreign Key in SQLite
Normally if you need to drop a foreign key in SQL, you’d use the ALTER TABLE
statement. But if you’re using SQLite, that’s not an option.
SQLite DROP TABLE
In SQLite, you can drop a table with the DROP TABLE
statement.
You can optionally add the IF EXISTS
clause to suppress any errors that might occur if the table doesn’t exist.
Also, if the table is referenced by a foreign key, there are a few things to be aware of.
Continue readingSQL DROP COLUMN for Beginners
In SQL, if you want to remove a column from a table, you need to use the ALTER TABLE
statement with the DROP COLUMN
clause.
That removes the column and all its data.
Continue reading