Viewing 15 posts - 241 through 255 (of 346 total)
Alternatively you could append the string in the select statement...
DECLARE @tk_total Varchar(2000)
SET @tk_total = ''
SELECT @tk_total = @tk_total +
CASE Len(@tk_total) WHEN 0 THEN '' ELSE
CASE WHEN tk_number IS...
August 15, 2004 at 10:25 pm
something like this??
use pubs
DECLARE @au_ID Varchar(20)
DECLARE @au_lname Varchar(100)
SET @au_ID = '172-32-1176'
-- SET @au_ID = NULL
SET @au_lname = 'White'
-- SET @au_lname = NULL
SELECT * FROM dbo.authors WHERE
au_id = CASE WHEN @au_id...
August 2, 2004 at 7:58 am
There might be a difference in the database options set on the test database and the production database which are suppressing the error messages on the test database...to check if...
June 30, 2004 at 7:22 am
I don't think there's any easy way to generally identify and remove duplicated column names that result from a join. If you use a "SELECT * " while joining two...
June 25, 2004 at 7:04 am
you could use the COLUMNPROPERTY function to check if a column is an identity column or not...
SELECT
COLUMN_NAME,
DATA_TYPE,
CASE COLUMNPROPERTY (OBJECT_ID('<TableName>'),COLUMN_NAME ,'IsIdentity') WHEN 1 THEN 'Identity Column' ELSE '' END Identity_Column
FROM...
June 24, 2004 at 1:34 pm
Razvan is right...my solution won't work...(from next time I'll try to test things out before posting.. )
May 13, 2004 at 3:07 am
since execute permissions to SET IDENTITY_INSERT default to sysadmin server role and db_owner and db_ddladmin db roles and the object owner if User2 is not part of any of these...
May 12, 2004 at 5:01 am
This article should help in deleting duplicates from your table:
http://www.sql-server-performance.com/rd_delete_duplicates.asp
April 23, 2004 at 9:31 am
these descriptions are stored in the sysproperties system table (don't know if they are also stored in any INFORMATION_SCHEMA view) along with the object id of the table...
this query should...
April 21, 2004 at 11:10 am
might be a problem with the int variables (@BusSrcId, @AdminId int, @FirmId int, @DaysOverdueRange) being used to generate the string...
try to CAST the int values as varchar and see if that...
April 13, 2004 at 10:39 am
You could alternatively write two update statements..
UPDATE #tbl SET
#tbl.Amount = #tbl.Amount + (SELECT Sum(T.Amount) FROM #tbl T WHERE T.RowNo < #tbl.RowNo)
WHERE #tbl.Type = 'S'
UPDATE #tbl SET
#tbl.Amount = #tbl.Amount...
March 19, 2004 at 12:58 pm
The scripts section of this site have lots of stuff for such situations...here are two scripts that do the "neat" casing...(in the T-SQL Aids scripts section)
http://www.sqlservercentral.com/scripts/contributions/981.asp
http://www.sqlservercentral.com/scripts/contributions/890.asp
March 17, 2004 at 10:12 am
Hi Alex,
the sysindexes, sysfiles and sysfilegroups system tables can be queried to get this info...
SET NOCOUNT ON
Declare @TabID int
Declare @TabName sysname
Create table #TabLocations(TableName sysname,FileGroupName sysname,LogicalFileName nchar(128),FilePath nchar(260))
Declare TabCUR CURSOR FOR
Select id,name...
March 17, 2004 at 5:58 am
You just need to make it SQL Server specific..
create table users
(
user_id int not null identity primary key,
username varchar(15) not null,
password varchar(8) not...
March 17, 2004 at 5:05 am
Hi,
This should work...
alter procedure mype
as
DECLARE @a varchar(200)
set @a= 'create table #mytable
( itemcode varchar(15),
itemname varchar(50),
unitname varchar(15),
unitprice money
)'
exec (@a) --...
March 16, 2004 at 5:48 am
Viewing 15 posts - 241 through 255 (of 346 total)