computed-columns

sql server computed column from other table

Possible Duplicate: formula for computed column based on different table's column Hi, does anyone know how to make a computed column with taking the value from another table? thanks ...

Identity key on varchar column - T-SQL

Hi there. I want to know if I can create an Identity (auto increment on a Varchar column. and how can I make it a primary key and create foreign key references on other table. This is the code i have - CREATE TABLE Questions( QuestionID int IDENTITY PRIMARY KEY, QuestionNo as 'Q'+Cast(QuestionID as Varchar(10), Que...

Sql Server deterministic user-defined function

I have the following user-defined function: create function [dbo].[FullNameLastFirst] ( @IsPerson bit, @LastName nvarchar(100), @FirstName nvarchar(100) ) returns nvarchar(201) as begin declare @Result nvarchar(201) set @Result = (case when @IsPerson = 0 then @LastName else case when @FirstName = '' then @LastName el...

Client want a field like PREFIX20100001

Client wants a field in the mysql DB to be composed of a prefix, the year, and a counter that resets each year. PREFIX 2010 0001 ... PREFIX 2010 0734, then PREFIX 2011 0001. Are there any mysql tricks to make that happen or do I keep track of the largest number used for each year. Any thoughts appreciated. ...

MySQL: Selecting the rows having min value of a computed column

The naive way of doing this that comes to mind would be: SELECT name, lev FROM (SELECT name, levenshtein(name, *parameter*) as lev FROM my_table) WHERE lev = (SELECT MIN(lev) FROM (SELECT name, levenshtein(name, *parameter*) as lev FROM my_table )); However the "(SELECT name, levenshtein(name, parameter) as lev FROM my_table)" subqu...

TSQL Computed column limitations

CREATE TABLE [dbo].[MembershipModule]( [Id] [uniqueidentifier] ROWGUIDCOL NOT NULL, [ParentId] [uniqueidentifier] NULL, [TargetId] [int] NULL, [WebContentId] [uniqueidentifier] NULL, [Name] [varchar](35) NOT NULL, [NameUpper] AS (isnull(upper([Name]),'')) PERSISTED NOT NULL, [UriPrefix] [varchar](max) NULL, [UriText] [varchar](...

Using SQL Server spatial types in SSIS data load

Hi there, I am trying to load a file using the SQL Server Import Data function - appending rows to an existing table. my existing table is created like this: CREATE TABLE [dbo].[load]( [Long] [varchar](50) NULL, [Lat] [varchar](50) NULL, [Geog] AS ([geography]::STGeomFromText(((('POINT('+[Long])+' ')+[Lat])+')',(4326))) )...