I am trying to create a persisted computed column using CASE expression:
ALTER TABLE dbo.Calendar ADD PreviousDate AS
case WHEN [Date]>'20100101' THEN [Date]
ELSE NULL
END PERSISTED
MSDN clearly says that CASE is deterministic, here
However, I am getting an error:
Msg 4936, Level 16, State 1, Line 1
Computed column 'Previo...
I have a previously developed project that I am working on now. The project uses SubSonic 2.1 as ORM and it has been working fine since we decided to move to a newer server. The new server has SQL Server 2008 SP1 and now SubSonic is not behaving as usual.
I debugged the case and found that SubSonic is now generating ANSISQL queries inst...
I am a first time BCP user. I have an XML file that I need to import into a new table in SQL Server. This is using SQL Server 2008 and BCP version 10.50.16. I read through the documentation but I get 370,000 errors! (This is a very large file). When I open the error log, I just see a bunch of question marks.
About this XML file: i...
SQL Server 2008 R2 has a new Master Data Services feature that includes some really nice regular expression matching & extraction functions:
http://msdn.microsoft.com/en-us/library/ee633712.aspx
I am running 2008 R2, and want to run those functions outside of the MDS database.
How can I? Is there a way to extract them and reapply the...
Hi,
in sql server 2005 there is initialization icon on the RS config manager but not in SQL server 2008/R2.. does anyone know?
using SQL server 2008 R2 and receving the error:
The report server installation is not initialized. (rsReportServerNotActivated) (rsRPCError) Get Online Help
...
This is my sql query:
select case when table.field1 = 1 then 1
when table.field2 = 3 then 3
when table.field2 = 4 then 4
when table.field3 = 1 then 5
else .... Status //item name
from table
I want that in case the "else" occurs -> the row will be removed from the dataSet.
I can't use "St...
Hi all,
I wan t to upload the xml data to the sql table. I am passing the xml data from .net(c#)(Working fine)
code:
ALTER PROCEDURE [dbo].[BookDetails_Insert] (@xml xml)
AS
insert into BookDetails (Pages,Descriptions)
SELECT
ParamValues.PLName.value('.','int'),
ParamValues.PLDEscr.value('.','text')
FROM
@xml.node...
What is the impact of Server collation on databases? We have dev and production environments on different server collations, is there a risk having these different server collations?
...
Hi All,
I am exporting xml data to sql server 2008 database.
.net code: http://stackoverflow.com/questions/3600091/how-to-pass-xml-from-c-to-a-stored-procedure-in-sql-server-2008
Query to insert: http://stackoverflow.com/questions/3606649/querying-a-xml-in-sql-server-2008
Everthing is working fine if the file size is small. Now the ...
Hi, I have a question. I am working on cursors. Each time, after fetching the last records and printing its data’s, the cursor prints an addition line. To understand what I mean please consider the following sample example:
I want to print the information about only 10 customers.
USE Northwind
GO
DECLARE myCursor CURSOR
FOR SELECT TO...
Hi
I have declared the following cursor and used a local variable @RowNo to print the number of each each row.
declare TheCursor cursor
for select productName from products
declare @RowNo int
declare @productName nvarchar(50)
set @RowNo = 1
open TheCursor
fetch next from TheCursor into @productName
print @RowNo
prin...
Hi,
I'm trying to trim some info from a table. The column has a number and then a word (e.g. 5 Apples). I just need the number so that I can sum the total of apples. I can't use count because I need to go by the value (e.g. 5 Apples for one, 3 Apples for the other) and count will just return that there are 2 entries and not pull the 5...
This is a fairly specific issue, but I'm at a loss for reasons to what might be happening.
We have SQL Server 2008 running on what we'll call ServerA. We can RDP in ServerA, we can ping ServerA. If we RDP into ServerA, we can open up SQL Server Management Studio and connect to all of the database instances running on ServerA just fine.
...
I'm doing an index report on my MS SQL 2008 database (Right click database -> Reports -> Index Usage Statistics)
It tells me that one of my indexes uses:
88 user seeks
0 user scans
6,134,141 user updates
Can someone explain to me:
What the difference between user seeks and user scans are?
How should I determine when to keep an in...
Getting an error running a sample MVC2 site because of DB version errors. I ran the installer for SQL Server Express 2008 R2 and it finished, I rebooted. Try to run the site again and see the same error. Downloaded/ran R2 installer and chose upgrade but there is nothing to upgrade... is something wrong in my VS2010 or windows in general?...
I am upsizing the back end of a client's Access app tomorrow and need to be ready with a plan for a particular problem with this client. The boss needs to be able to take the data file away from the office where the SQL Server is on a regular basis (usually monthly) and run statistical analyses on the data.
I've looked at Easiest way to...
I was trying to run a script to create a DB with all the tables and data on a server, which I created using script wizard in SSMS 2008. The destination server is 2005 and since I am unable to just restore a backup, I had to go through this long process which entailed running it through sqlcmd cause it was too large to open in SSMS.
But a...
I'm using MS SQL 2008 and I'm facing a challenge for a few day's now.
My SP parameter can contain one to three words in a string (nvarchar) and I have to return matching LIKE %phrase% records for each word in a string.
Example. My parameter is:
"stack overflow"
Records that must be returnd:
miSTACKon
noOVERFLOWon
STACKit
poOWERFLOW...
I am using migratordotnet to sync my SQLServer 2008 database and need to create a column of type Text...
Am at a bit of a loss as to how to do this, as there is no System.Data.DbType.Text??
...
I just realized I have a clustered index on a Timestamp in descending order. I'm thinking about switching it to ascending, so that as new, ever-increasing timestamps are inserted, they are added to the end of the table. As it stands now, I suspect it has to add rows to the beginning of the table, and I wonder how SQL Server handles tha...