Forum Replies Created

Viewing 15 posts - 301 through 315 (of 395 total)

  • RE: replace

    Do you always want to NULL the second zero, or is it more complicated?

  • RE: table sub division on sql server 2000

    raghuldrag (8/28/2012)


    ...

  • RE: increment values on day basis on column

    This will work for adding one at a time:

    --------------------------------------------------------------

    drop table #test;

    create table #test ( id varchar(13) );

    --------------------------------------------------------------

    declare @id varchar(13), @nextid varchar(13);

    select @id = max(id) from #test;

    select @nextid = case when...

  • RE: Need Create View Script for all tables

    RBarryYoung (8/24/2012)


    laurie-789651 (8/24/2012)


    Out of interest, what do you use the table-wrapper views for?

    I assume that you meant me?

    Yes - should have quoted!

    Thanks for the gen. I haven't come across...

  • RE: Need Create View Script for all tables

    Out of interest, what do you use the table-wrapper views for?

  • RE: Is it OK to ask salary range before applying?

    You could waste a lot of time applying for jobs you won't take. OK if you've got the time...

  • RE: need to display column to row

    Cross apply values technique:

    insert into #temp1 values (2004,'002445166',28,34,32,94)

    insert into #temp1 values (2005,'002445166',19,35,66,75)

    SELECT iSchoolYearCode,cStudentID,[Subject],Score

    FROM #temp1

    CROSS APPLY (

    VALUES

    ('Math', iMathScaleScore)

    ...

  • RE: Year Wise Query Report Doubt

    This is a simple way of doing it:

    create table #crime

    (

    id int,

    Category varchar(10),

    [Date] DateTime

    );

    insert #crime values ( 1, 'Murder', '2012-08-11 18:45:55.780' );

    insert #crime values ( 2, 'Murder', '2010-07-11 17:45:55.780' );

    insert #crime...

  • RE: synatx

    You would normally pass 2 date parameters to a procedure: @StartDate and @EndDate like this (using the syntax recommended above)

    CREATE PROCEDURE dbo.xxx

    (

    @StartDate DateTime,

    ...

  • RE: My Function should return selective part of String

    Is this what you want (using the LEFT(..., 1) function)?

    ALTER FUNCTION [dbo].[FnSplit_string]

    (

    @List nvarchar(max),

    @SplitOn nvarchar(max)

    )

    RETURNS @RtnValue table

    (

    Id int identity(1,1),

    Value nvarchar(max)

    )

    AS

    BEGIN

    While (Charindex(@SplitOn,@List)>0)

    Begin

    Insert Into @RtnValue (value)

    Select Value = LEFT(ltrim(rtrim(Substring(@List,1,Charindex(@SplitOn,@List)-1))),1)

    Set @List =Substring(@List,Charindex(@SplitOn,@List)+len(@SplitOn),len(@List))

    End

    Insert Into @RtnValue...

  • RE: handheld scanner

    You'll upset people by posting the same thing twice!!

    Also - it's not really a SQL Server question.

    I used to print out data using the barcode font & scan that when...

  • RE: Cast and count in a single statement

    If you group by Server & DB, COUNT() is always 1 (as far as I can see).

    How about this:

    create table XYZ

    (

    ServerName varchar(10),

    dbname varchar(10)

    );

    insert into XYZ values ( 'server1', 'db1' );

    insert...

  • RE: synatx

    Can you clarify your question?

    Do you mean (for example) How do you select all DateTimes with the years 2011-2012?

    If so, then it's:

    WHERE YEAR(DateTime) = 2011 OR YEAR(DateTime) = 2012

    This is...

  • RE: Drop Table if exists

    Lowell (8/23/2012)


    laurie-789651 (8/23/2012)


    Why is avoiding syntax checking a good idea?

    It's a holdover from how my scripts get deployed; trying to avoid GO statements, so everything gets wrapped into dynamic SQL...

  • RE: Drop Table if exists

    Why is avoiding syntax checking a good idea?

Viewing 15 posts - 301 through 315 (of 395 total)