Viewing 15 posts - 16 through 30 (of 82 total)
.......
declare @criteria varchar(500)
set @Criteria = 'product'
select distinct name
-- optional text excerpt:
/*,replace('... ' + substring(text, (patindex('%' + @Criteria + '%',text) - 55), 155)
+ ' ...', ...
December 8, 2003 at 8:31 am
Unless I misunderstand, wouldn't something like this be what your after:
select
CategoryID,
Count(*) as [Count]
from TableName
group...
December 8, 2003 at 6:18 am
ok... Not finished yet
How about the following.
If I am still oversimplifying things, then I appologise, and I will get back to my own work!!!
(Shame all the...
December 5, 2003 at 8:33 am
Is this the kind of thing you are after?
create table #temp (name varchar(50), Code varchar(50), CodeDesc varchar(50), Jan int,Feb int)
set nocount on
insert into #temp values ('JohnGinglehim', '45','Sick', 16, 0)
insert...
December 5, 2003 at 7:44 am
I don't think your going to be able to easily do this in a function. It can be done quite easily in an SP:
create proc Max
@T varchar(255),
@C...
December 2, 2003 at 10:40 am
Try having a look at the INFORMATION_SCHEMA. Views in SQL Books Online.
eg:
select * from INFORMATION_SCHEMA.Columns where Table_Name = "TableName"
December 2, 2003 at 8:03 am
Suggestion:
select count(*) from
(
select 1 as Num
from dbo.tbl_DocumentDownloads DD
where ......
group by
DD.fk_intDocumentID,
DD.fk_intUserID
)as A
December 2, 2003 at 5:38 am
Ahh, sp_pkeys, have to remember that one!
beats my method!! =:)
November 26, 2003 at 10:10 am
Try looking at INFORMATION_SCHEMA views in Books On-line:
This select will pull out the column names that make up the (Primary) key.
declare @TableName varchar(255)
set @TableName = 'TABLE NAME'
select COLUMN_NAME
from INFORMATION_SCHEMA.KEY_COLUMN_USAGE...
November 26, 2003 at 7:52 am
Or......
declare @N int
declare @m int
set @N = 86548
set @m = 21458
select
cast(left(@N,1) + replicate(0,len(@N)-1) as int)
*
cast(left(@M,1) + replicate(0,len(@M)-1) as int)
November 26, 2003 at 2:45 am
Books on line: User Defined Functions:
Calling User-Defined Functions
When calling a scalar user-defined function, you must supply at least a two-part name:
SELECT *, MyUser.MyScalarFunction()
FROM MyTable
Table-valued functions can be called by using...
November 25, 2003 at 9:38 am
Where are you getting the float from?.
Is it from a table, or an external source
November 12, 2003 at 9:44 am
..>>..
you can do
select count(distinct col1), count(distinct col2),... from TableName
But your still going to need to list each field
..<<..
November 12, 2003 at 9:37 am
Your @@Error number is being lost with the if @@Error <> 0 begin part (ie: this part does not produce any errors).
Pass the @@error into another variable immediately after the...
November 5, 2003 at 8:03 am
Viewing 15 posts - 16 through 30 (of 82 total)