Viewing 15 posts - 286 through 300 (of 541 total)
Where could one get a list of these standard codes?
July 27, 2004 at 12:31 pm
Here's the full script:
if object_ID('tempdb..#Payment') is not null drop table #Payment
CREATE TABLE #Payment(
PaymentID int identity Not nUll Primary Key,
CustomerNumber int NOT NULL,
PostedDatetime datetime NOT NULL,
PaymentAmt money NOT NULL,
PaymentMemo varchar(200) NOT NULL,
CCRefNum char(10) NOT NULL
)
Insert #Payment Values (1, '01/01/2004', 1, '',...
July 26, 2004 at 11:55 am
This is a pretty good technique, but there are problems with it. Using derived tables in a query can be very powerful, but they can also cause excessive use of...
July 26, 2004 at 11:53 am
true, or you can use something like this (for a csv, say):
select @var = isnull(@var + ',', '') + value from table.
If I dealing with a lot of rows or...
July 1, 2004 at 12:20 pm
Nope...didn't test it. You're right though, it doesn't work.
Very odd...
cl
June 28, 2004 at 3:49 pm
Although you can have only one PK, you can have multilple columns in your PK.
ALTER TABLE [dbo].[Table] DROP CONSTRAINT [TablePK]
GO
ALTER TABLE [dbo].[Table] ADD CONSTRAINT [TablePK] PRIMARY KEY CLUSTERED
(
[PK1],
[PK2]
 
June 28, 2004 at 2:10 pm
No need for a derived table or COALESCE function:
SELECT DISTINCT @strString1 = @strString1 + sql_name + ', '
FROM #temp A ORDER BY SQL_name
June 28, 2004 at 2:05 pm
If you absolutely must have a unique stamp for each row, then simply use the uniqueidentifier data type.
cl
June 24, 2004 at 1:11 pm
Wow, if your trigger is timing out you've got some serious problems. I'm a little confused at to what you mean by data view. What are you using to view...
June 23, 2004 at 12:44 pm
if you're worried about triggers screwing with @@Identity, use the function SCOPE_IDENTITY( ) instead. Or you can use IDENT_CURRENT('table_name')...
Lot's of options for attaining the last identity column...it's a nice feature...
June 23, 2004 at 12:34 pm
Actually, there are two functions you can use. select Month(getdate()), and select datename(mm, getdate()).
As far as doing a pivot table...in that each month becomes a column...is a lot more complicated. ...
June 22, 2004 at 7:36 pm
Here is an elegant way to do this:
delete t1
from NA_ATTRIBUTE_DATA t1
JOIN NA_ATTRIBUTE_DATA t2 on t1.MONBR = t2.MONBR
where t1.ROWNUM < t2.ROWNUM
This will delete all records in the table where the MONBR...
June 22, 2004 at 7:28 pm
You can't do this in a function, as you can't issue "Update" commands on any tables (except table variables).
Also, using the syntax Kenneth proposed (which is good, although using an...
June 22, 2004 at 7:25 pm
If there is no primary key violation (which there probably should be in an ideal schema), you can join the table to itself and delete all older records in the...
June 22, 2004 at 7:16 pm
There are a bunch of SQL scripts that are better than the soundex functions. For example, the script at this site:
http://www.tek-tips.com/gfaqs.cfm/lev2/4/lev3/27/pid/183/fid/4110
correctly equates "Knight" to "night".
select dbo._SoundexAplhaFunction ('knight'),
dbo._SoundexAplhaFunction ('night')
returns...
June 22, 2004 at 7:09 pm
Viewing 15 posts - 286 through 300 (of 541 total)