User Profile

Collapse

Profile Sidebar

Collapse
folderol
folderol
Last Activity: Mar 30 '07, 08:39 PM
Joined: Jul 25 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • folderol
    replied to Just a quickie..
    Code:
     
    ALTER TABLE [dbo].[my_tablename] WITH NOCHECK ADD 
    CONSTRAINT [PK_my_contraintname] PRIMARY KEY CLUSTERED 
    (
    [recno]
    ) ON [PRIMARY]
    You can use scripting to create a script of the primary key for an existing table, then edit the script to add the key to another table. In SQL2000 it's Tools, Generate SQL Script. In SQL2005 it's a bit harder to find from the UI of SQL enterprise manager....
    See more | Go to post

    Leave a comment:


  • Code:
    resultssql = "SELECT * FROM testtable 
    where name = '" & request("name") & "' AND 
    cast(fromd as datetime) >= '" & getdatefrom & "' AND 
    cast(fromd as datetime) <= '" & getdateto & "'"

    getdatefrom and getdateto can be varchar, but it would be nice if they were in the form '20070101' or '1/1/2007' so the implicit conversion is not...
    See more | Go to post

    Leave a comment:


  • You should read the topic
    DBCC CHECKIDENT
    in books on-line help. If I understand correctly what you are trying, it won't work.

    You will have to write code to generate your own FK values.

    Tom....
    See more | Go to post

    Leave a comment:


  • folderol
    replied to Int / Int does not give decimal value
    For SQL, one of the numbers must be numeric. You can solve this for constants simply by expressing them as
    select 2800 / 1000.0

    for columns you should use

    select 2800 / cast( my_integer_colu mn as decimal(10,2))

    Tom...
    See more | Go to post

    Leave a comment:


  • Hey, a couple of points...
    SQL uses + for concatenation so you need to change your where statement to
    ((Jobs.JobSeria l) = " + @intJobSerial + ")

    JohnK is right, if intJobSerial is a local variable then it needs to be declared and it must begin with an @.

    There is nothing wrong with the FROM statement, it's a little unusual to delay the two ON clauses at the end but this gives a different result set...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...