This is a migrated thread and some comments may be shown as answers.

SQL queries: parameters' types specific or universal?

4 Answers 68 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
tmlipinski
Top achievements
Rank 1
tmlipinski asked on 15 May 2009, 08:32 AM
Hi,

Let's assume I have such instructions (working under MS SQL Server):
IQuery query = scope.GetSqlQuery("select * from MyTable where Name = ?"null"nvarchar name");  
IQueryResult res = query.Execute(new object[] { "aqq" }); 
Is "nvarchar" server-specific or universal? I mean - will it work for Oracle too or I must change it as "nvarchar2 name"? If it is server-specific - how can I determine the type of currently used server?

Regards
Tomasz

4 Answers, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 15 May 2009, 08:58 AM
Hi tmlipinski,
Sql is always backend specific. Why do you use sql instead of oql or linq?

Best wishes,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
tmlipinski
Top achievements
Rank 1
answered on 15 May 2009, 09:22 AM
Hi,
Thanks for the quick reply.
In general I use OQL, of course. But sometimes I need to use SQL - for example to read data from a view, not from tables directly; or to execute a stored procedure from another database; or to ask a complex, analytical query. 
So, my last question is still valid: how can I determine the type of the currently connected server?

Regards
Tomasz
0
Jan Blessenohl
Telerik team
answered on 15 May 2009, 09:36 AM
Hi tmlipinski,
The only way at the moment is to use Database.ConnectionURL. This string contains a "backend=" part that gives you the specified backend string like mssql or oracle.

Sincerely yours,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
tmlipinski
Top achievements
Rank 1
answered on 15 May 2009, 10:00 AM
HI,
OK, that's enough. Thanks.

Regards
Tomasz
Tags
Databases and Data Types
Asked by
tmlipinski
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
tmlipinski
Top achievements
Rank 1
Share this question
or