Is this the best way to keep a simple track of changes to a database row: So any update to a row in [121s] will result in the modified column being updated. It works, but I’m not sure if it’s the best way to achieve this. I’m a litle confused over this line: …and how it knows it’s getting the
Tag: sql-server-2008
MSSQL cast( [varcharColumn] to int) in SELECT gets executed before WHERE clause filters out bad values
Assume the following schema and query: Please look past the glaring design issues with having values in a varchar column that we expect to be ints. The break: We get a cast break due to a value that cannot be converted to an int. In this case: “123-1”. The strange thing is that the value being cast gets filtered out
Check if datetime is in current date
I am using SQLServer 2008. I have a table X with field Y that is a datetime format. In the WHERE statement of my query I only want to keep the rows where the date of field Y equals the current date. …
IIF(…) not a recognized built-in function
I’m trying to use this in Microsoft SQL Server 2008 R2: But I get an error: IIF(…) is not a recognized built-in function name Is IIF() only compatible with a later version? Is there an alternate function I can use? Answer IIF comes from SQL 2012. Before then, you can use CASE:
alter column table and make default value to empty string
good day.. just want to ask, is it possible to alter a column table and make the default value to empty string.. i tried using this query, Alter Table Employee Alter Column sJobTitle Varchar(…
Insert multiple rows into single column
I’m new to SQL, (using SQL 2008 R2) and I am having trouble inserting multiple rows into a single column. I have a table named Data and this is what I am trying That code was taken from this question, but it, like many other examples I have found on the web uses 2 columns, I just want to use
FULL OUTER JOIN vs. FULL JOIN
Just playing around with queries and examples to get a better understanding of joins. I’m noticing that in SQL Server 2008, the following two queries give the same results: Are these performing exactly the same action to produce the same results, or would I run into different results in a more complicated example? Is this just interchangeable terminology? Answer Actually
SQL Server database backup file (.bak ) file gets corrupted
I have been working on a SQL Server database designing since long now and I have observed that when a .bak file is mailed or kept and downloaded from ftp site, it gets corrupted. When I try to restore, it gives me 3013 error code with messsage: “Backup or restore operation terminating abnormally. I tried RESTORE VERIFYONLY FROM DISK=’C:abc.bak’ as
NULL values are excluded. Why?
This is about a bizarre behaviour I found in Microsoft Sql Server. Please correct me if I’m wrong. SELECT COUNT(*) FROM TABLEA WHERE [Column1] IS NULL; This returns 30018 rows. CREATE VIEW VIEWB …
Connecting to SQL Server Express – What is my server name?
I was just given a laptop to perform some development from a client and I am currently in the process of setting it up. Visual Studio 2010 is installed as well as SQL Server Management Studio 2008 R2. I’m trying to open SQL Server Management Studio to connect to the database but so far am not having much luck. I’m