Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Help with a query : error with Instr

Author  Topic 

vaddi
Posting Yak Master

145 Posts

Posted - 2007-03-08 : 12:30:49
Hello,

I have the following query which I actually run in the MS-Access to get the result.But it was not returning any rows , so I am testing in SQL analyser.

SELECT dbo_pple_t_Student_Profile.ix_Student_Number AS Expr1,
dbo_pple_t_Person.ix_Last_Name, dbo_pple_t_Person.ix_First_Name,
dbo_rmgt_t_Room_Person.CK_BED_SPACE, dbo_rmgt_t_Room_Person.CK_MOVE_IN_DATE,
dbo_rmgt_t_Room_Person.CHECK_IN, dbo_rmgt_t_Room_Person.ROOM_PERSON_MOVE_OUT_DATE,
dbo_rmgt_t_Room_Person.CHECK_OUT,
Mid([ck_bed_space],1,InStr(1,[ck_bed_space],"-",2)-1)instr AS Building INTO [OccupancyTotals-Chargeback]
FROM dbo_rmgt_t_Room_Person, dbo_pple_t_Person, dbo_pple_t_Student_Profile
WHERE ((dbo_rmgt_t_Room_Person.FK_TERM_ID)="0760"));

When I execute this I get the error:
Server: Msg 195, Level 15, State 10, Line 6
'InStr' is not a recognized function name.

What should I do or change with the syntax.Is there any difference between the queries in access and sql .

Thanks

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-03-08 : 13:04:05
Transact-SQL does not have Mid or Instr, you'll need to look up the Transact-SQL functions instead. Look up "functions, string" in Books Online.
Go to Top of Page
   

- Advertisement -