Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by SmileyConspiracy

  1. SmileyConspiracy

    Insert multiple records without loop

    You can do this with a cross join to another table. declare @tblA table( id int, tot int) declare @tblB table( id int) declare @tot table (tot int) insert @tblA values( 1, 2) insert @tblA values( 2, 3) insert @tot values( 1) insert @tot values( 2) insert @tot values( 3) insert @tblB...
  2. SmileyConspiracy

    Stored procedure jumping lines of code

    Any codelonger that a single statement in an IF… ELSE block needs to be contained within BEGIN and END statements so you get IF <condition> BEGIN <some code> END ELSE BEGIN <some other code> END Also the second IF statement (“if @dbname = 'scheme'”) will overwrite the correct string...
  3. SmileyConspiracy

    I am executing an SQL statement for

    I think a case statement similar to this should give you the results you want. SELECT ID, LoginName, CASE WHEN Password1 = 'Pass' THEN 'Password1 Match' WHEN Password2 = 'Pass' THEN 'Password2 Match' WHEN Password3 = 'Pass' THEN 'Password3 Match'...
  4. SmileyConspiracy

    Need a carriage return in a net send statement..

    I haven’t tried this with net send but can you concatenate char(13) into your message string. So, set @message = ‘Hello‘ + char(13) + ‘Steve’
  5. SmileyConspiracy

    Change column name in T-SQL

    Probably the easiest way of renaming an object is to use sp_rename. For a column you would use some thing like this. EXEC sp_rename 'ColumnName', 'NewName', 'COLUMN'
  6. SmileyConspiracy

    [Microsoft][ODBC SQL Server Driver]Unknown token received from SQL Ser

    Have just had a similar problem with a very different query. We found the problem only occurred where service pack 3 hadn’t been installed on the client. Hope this helps.
  7. SmileyConspiracy

    DTS and Visual Basic

    This can be done using a DTS package, the simplest way is to change the transform data task in your package. Rather than outputting directly from the table use an SQL query similar to this, Select 'point' Point, A, B from tbl Which will give you, an additional column word point for every row in...
  8. SmileyConspiracy

    table joining problem

    You need to use an outer join. e.g. select * from a left outer join b on a.ID_Field =b.ID_Field
  9. SmileyConspiracy

    Help with update query

    Strange, can I see a sample of your data, just the fields tblGlobal_Availability: Isin, Dirty Price and tblGSP55S9X - Security Data: ISIN, price
  10. SmileyConspiracy

    Help with update query

    This should work. UPDATE dbo.[tblGlobal_Availability] SET dbo.[tblGlobal_Availability].[Dirty Price] =SecurityData.[price] FROM dbo.[tblGlobal_Availability] Availability LEFT OUTER JOIN dbo.[tblGSP55S9X - Security Data] SecurityData ON Availability.Isin =SecurityData.ISIN WHERE...
  11. SmileyConspiracy

    Using IFs in Select Statements

    You can't use IF's in this way, what's need is a CASE statment. Though this can also be done with an ISNULL function depending on your data. If you have null's in BB where there is no value then use IsNull. Select IsNull( BB, AA) *CC From tbl However if you have 0 in BB where there is no value...
  12. SmileyConspiracy

    help needed w/difficult sql query

    I think this should do what you want, but you may find it runs slowly if you’re working on lots of data. update table3 set table3.approver = s1.approver from table3 t3 inner join ( select req_id, approver from table1 t1 cross join table2 t2...
  13. SmileyConspiracy

    Creating a list of column names output by a view

    I need to Create a list of column names output by a view. Not a problem using sysobjects and syscolumns. The problem is that I also need to get the tablename for where each column comes from. i.e. if I had the following as a view Select Person.DomicileId, Person.PersonId from Person Inner Join...

Part and Inventory Search

Back
Top