Forum Replies Created

Viewing 15 posts - 76 through 90 (of 119 total)

  • RE: nth row

    VARCHAR can be sorted (unless there is some other way that defines the sort order of that table). In your case, you will be sorting by NAME alphabetically.

    If you...

  • RE: Help with SQL Statement (is it possible)

    Thanks for your response.

    However, wouldn't it be better to build this report using relational programming rather than something else like procedural programing? All we are trying to do is...

  • RE: nth row

    USE NORTHWIND

    SELECT TOP 1 *

    FROM (

    SELECT TOP N * FROM Employees ORDER BY EmployeeID ASC

    ) X ORDER BY EMPLOYEEID DESC

    where N is the ordinal position of the record you want...

  • RE: Help with SQL Statement (is it possible)

    Thanks for your response.

    However, the number of groups is unknown. Therefore, generating a dynamic query (ie. piecing it together the SQL statement) may not be the best solution for...

  • RE: Script to enumertae size, #rows in DB tables

    EXEC sp_MSforeachtable "print '?' dbcc checktable ('?')"

  • RE: Unable to use BETWEEN with date value!

    A comment on CASTing a text value into a date datatype:

    It is always better to use CONVERT instead of CAST for explicit conversion, especially in the international environment. Please...

  • RE: Updated Table like Inserted and Deleted?

    inserted and deleted tables are used in conjunction with triggers.

    See example below:

    /* -- cut here -- */

    use tempdb

    begin tran

    set nocount on

    create table table1(id int identity(1,1), value varchar(50));

    go

    create trigger tr_table1 on...

  • RE: HELP please on stord PROCEDURE

    DECLARE @inmhlka VARCHAR(20)

    DECLARE @exec_stat VARCHAR(1000)

    SET @inmhlka= '1,2,3,4'

    SET @exec_stat = 'SELECT dbo.Table1.Field1, dbo.Revenue.Services FROM dbo.Revenue INNER JOIN dbo.Table1 ON dbo.Revenue.Services = dbo.Table1.Field1 WHERE (dbo.Revenue.Services IN (' + @inmhlka + ')) ORDER...

  • RE: HELP please on stord PROCEDURE

    When you use SET @inmhlka= '3,4,6,7,8,9,10', it is looking for the value '3,4,6,7,8,9,10' in the service field. That is why it works when you search for '3'.

    In this case,you...

  • RE: Question about Table Sequence script

    there are only 3 params...

    sp_MSobject_dependencies name = NULL, type = NULL, flags = 0x01fd

    name: name or null (all objects of type)

    type: type number (see...

  • RE: How to format date to mm/dd?

    Thanks. "Select Convert(Char(5),GetDate(),101)" gives me exactly what I asked for.

    However, I used the wrong example to illustrate my question. What if I want "MM/YYYY"? Do I have...

  • RE: Getting Windows User ID in Trigger or SP

    just an aside note, you might want to review what kinds of permission the "generic SQL Server ID" sa should be having. In general, it is a good idea...

  • RE: Check constraint

    You can use a check constraint for this...

    Hope that helps

    Billy

    /* -- cut here -- */

    begin tran

    set nocount on

    create table aaa(a int,b int,c int,constraint chk_aaa check((a is not null and b...

  • RE: CASE Issue..Need Help

    Try this... hope that helps shed some light...

    Billy

    /* --- cut here --- */

    begin tran

    set nocount on

    create table aaa(aaa_value int);

    insert into aaa(aaa_value) values(1);

    insert into aaa(aaa_value) values(2);

    insert into aaa(aaa_value) values(3);

    create table bbb(bbb_value...

  • RE: how to copy proc from one db to another

    Thanks Michael.

    The sp_helptext method is not an option because the proc is over 8000 chars long (the entire create proc script will not fit in the varchar(8000) I declare for...

Viewing 15 posts - 76 through 90 (of 119 total)