LEFT OUTER JOIN with a WHERE clause

Try: SELECT WO_BreakerRail.ID, indRailType.RailType, WO_BreakerRail.CreatedPieces, WO_BreakerRail.OutsideSource, WO_BreakerRail.Charged, WO_BreakerRail.Rejected, WO_BreakerRail.RejectedToCrop FROM indRailType LEFT OUTER JOIN WO_BreakerRail ON indRailType.RailCode = WO_BreakerRail.RailCode AND WO_BreakerRail.Date = @Date Thus adding AND WO_BreakerRail.Date = @Date onto the join

SQL LocalDB vs SQL Server CE

See the Introducing SQL Server Express Local DB Runtime presentation – gives a great overview. The huge benefit of LocalDB is that it’s real SQL Server – it’s a special version of SQL Server Express, but it basically supports everything that “real” SQL Server has – spatial data types, stored procedures – you name it. … Read more

INSERT into table without specifying Column names

As long as you have the right number of columns in your INSERT statement, and as long as all the values except KEYBOARD are some numeric data type, and as long as you have suitable permissions, this should work. INSERT INTO INVOICE VALUES( 1,1,’KEYBOARD’,1,15,5,75); SQL requires single quotes around text values. But not using column … Read more

SQL – Check if a column auto increments

For MySql, Check in the EXTRA column: SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ‘my_table’ AND COLUMN_NAME = ‘my_column’ AND DATA_TYPE = ‘int’ AND COLUMN_DEFAULT IS NULL AND IS_NULLABLE = ‘NO’ AND EXTRA like ‘%auto_increment%’ For Sql Server, use sys.columns and the is_identity column: SELECT is_identity FROM sys.columns WHERE object_id = object_id(‘my_table’) AND name=”my_column”

How can I get the list of tables in the stored procedure?

The two highest voted answers use a lot of deprecated tables that should be avoided. Here’s a much cleaner way to do it. Get all the tables on which a stored procedure depends: SELECT DISTINCT p.name AS proc_name, t.name AS table_name FROM sys.sql_dependencies d INNER JOIN sys.procedures p ON p.object_id = d.object_id INNER JOIN sys.tables … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)