Hello, try this:
declare @myTable table (
id int identity primary key not null,
foo varchar(100) not null
)
insert into @myTable values('abc|def')
insert into @myTable values('abc|def|')
insert into @myTable values('abcd|efgh')
insert into @myTable values('abcd|efgh|ij|kl')
--select values...
I have tested it also on Express 2008 and it works fine if you write all via sql code.
Btw. I apologize, but on my Firefox didn't show any of adult ads. I used imagevenue a few years ago and they had any adult ads. So now I see, they have changed it.
Of course first of all I tried use the...
You are right, I tested it and intellisence didn't work with manually created table. But it works with sql code created tables. So I suppose this should be the solution... :)
Hi. It really depends on what values can be there...
Try this:
create table example(
foo varchar(100)
)
insert into example values('PR10232A')
insert into example values('123456A')
insert into example values('65498566ABC')
insert into example values('65AD123456AB')
select...
I tried it and it works for me. I didn't create the table, but it is showed in intellisence. Look at picture:
http://img240.imagevenue.com/img.php?image=21843_file01_122_514lo.jpg
This is my version of SQL Server:
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86) Jul 9 2008...
Hello,
list of all errors is here for SQL Server 2005 or 2008:
select * from sys.messages
and here for SQL Server 2000:
select * from master.dbo.sysmessages
But you can catch errors in SQL Server 2005 or 2008 in T-SQL. Here is demonstration how TRY/CATCH works...
You can also write constraint:
create table example(
col1 int
)
alter table example
add constraint mod3
check (col1%3=0)
insert into example values (0)--is ok
insert into example values (1)--fails
insert into example values (3)--is ok
insert into example values (4)--fails
Hi.
Is in T-SQL possible to do something like switch in PHP?
www.php.net/switch
I have this code:
declare @variable int
set @variable=3
if @variable=1
begin
print 'a'
print 'another t-sql commands continue...'
end
else if @variable=2
begin
print 'b'
print 'another t-sql commands...
Hi.
First of all backup your data. Than you can use REPLACE():
select replace('myAccount@e-mail.com','e-mail.com','newe-mail.com')
returns
myAccount@newe-mail.com
For UPDATE it could work like:
update yourtable set email=replace(email,'e-mail.com','newe-mail.com')
In SQL server 2005 you can use DENSE_RANK(), which should do exactly what you want.
declare @myTable table(
start datetime,
info varchar(20)
)
insert into @myTable values ('20080501','Median deposit')
insert into @myTable values ('20080501','Average deposits')
insert into @myTable values...
Hi George.
First of all I want thank you for your hard work at this forum. I really love read your answers!
I have a question. Why did you use function Min()?
Min(case when sitm_sapc = 6 then 'X' else null end) as cen
may return 'X' or null.
If I try:
select min('X') --return X
select...
Hi.
I suppose you need the same funcionality as in Excel function SUMPRODUCT(). Here is example, but be aware how this method work with NULL values. It will not include NULL values in your sum result.
declare @mytable table (
col1 int identity not null,
col2 int
)
insert into @mytable...
Hi,
Here is example:
SELECT *
FROM [honza\sqlexpress].[AdventureWorks2008].[HumanResources].[Department]
means:
[honza\sqlexpress] = computer with SQL Server where you want connect
[AdventureWorks2008] = name of database
[HumanResources] = name of schema
[Department] = name of table
Server...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.