Possible To Use Like Hint With Sub-select?

Sep 26, 2013

Is possible to use like hint with subselect? , i mean i want to find all rows in table A that contains a word in a field(CALLED CONTENT) in table B, concretely in a field called content too, i show you the idea although the syntax is incorrect.

select
' + char (39) + @country + char (39) + ' as PAIS,
A.ID,
A.IDUSUARIO MSISDN,
NULL AS MSISDN_COD,
convert(char(19),A.FECHA_ALVENTO, 121) AS FECHA_MO_LOCAL,
NULL AS FECHA_MO_LOCAL_D,

[code]....

View 1 Replies


ADVERTISEMENT

Select Col42 From Tbl With (NOT INDEX (myidx)) - Hint Saying Do Not Use Possible?

Nov 28, 2007



Hello!
I would like when I compare query plans to be able to compare
2 queries where the 1. is the "normal" version and the 2. the version where I forced compiler
not to use a specific index (i don't want to force at table scan, so hint index(0) can't be used).

The only way I see how I could achieve something similar is to to drop the index and compare response time
before and after. But building index could be time consuming...

Is it possible?

select col42 from tbl;
select col42 from tbl with...

pressing CTRL+L

Greetings
Bjørn

View 1 Replies View Related

BCP - Hint Exceeds

Jan 3, 2007

Query hints exceed maximum command buffer size of 1023 bytes(1029 bytes input).

i tried a long query in BCP because i have to insert a character to one of its fields.

hope somebody had encountered and solved this (sql server 2000). thanks in advance..

View 8 Replies View Related

When To Use The NOLOCK Hint.

Jul 20, 2005

Background:I am currently working on a mission critical web based applicationthat is accessed 24 hours a day by users from just about every timezone. We use MS SQL Server as our database and we have lots ofproblems with time-outs. We used to have lots of problems with locksuntil my management decided that we would use the WITH (NOLOCK) hinton EVERY select statement and WITH (ROWLOCK) on EVERY updatestatement. I have argued since the beginning that the NOLOCK hintshould be the exception and not the rule. Meanwhile we continue tohave problems related to time-outs.Problem:I'm the one that they call when there are time-out errors.I am a programmer first and a DBA when I have to be. I'd really liketo hear from some of you who are the opposite. I realize that thereare many factors that contribute to slow response from a databaseserver (indexes, RAM, disk speed, etc.), but what I really need tohear from an expert is whether or not using NOLOCK on **EVERY** queryin a 30GB database that has 344 tables is a bad idea.Thanks in advance,Stephen McMahonJoin Bytes!

View 2 Replies View Related

NOLOCK Hint On Views?

Nov 27, 2007

Hi all
If i have a view:
CREATE VIEW vw_Users
AS
SELECT * FROM Users WITH(NOLOCK)
 
Is it suggested to use nolock in views?
And if i needed to use this view in stored procs is it then suggested to apply the nolock hint?
CREATE PROC [dbo] .[usp_GetCompanyUsers]
AS
SELECT * FROM Companies WITH(NOLOCK) JOIN
vw_Users WITH(NOLOCK) --<< ---is this suggested?
 

View 1 Replies View Related

Subselect In A Query With Like Hint

Sep 26, 2013

Is possible to use like hint with subselect? , i mean i want to find all rows in table A that contains a word in a field(CALLED CONTENT) in table B, concretely in a field called content too, i show you the idea although the syntax is incorrect.

select
' + char (39) + @country + char (39) + ' as PAIS,
A.ID,
A.IDUSUARIO MSISDN,
NULL AS MSISDN_COD,
convert(char(19),A.FECHA_ALVENTO, 121) AS FECHA_MO_LOCAL,
NULL AS FECHA_MO_LOCAL_D,

[code]...

View 2 Replies View Related

Lock Hint Question

Jul 20, 2005

Hi All,I have a question about lock hint for you :If the first user currently run a select commandwith share lock and hold it. What kind oflock (lock hint) should be used by the second userin the select command (from the same table) so thatthis command will wait until the first user releasesthe lock ?I have tried using tablock, tablockx, xlock andupdlock hint in the select command for the seconduser, but it is not successful. Below is myunsuccessful test :The first user :Begin Transactionselect fprefix from ut1 where fprefix = '000'The second user :select * from ut1 with (tablockx)Please help meThanks in advanceAnita Hery*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 2 Replies View Related

No Lock Hint - Across Servers

Aug 1, 2007

Can I use the NO Lock hint when running a SELECT against a view that points to another server? Will the no lock "travel" to the other server through the view?

amk


View 4 Replies View Related

Index Hint Syntax Help

Sep 28, 2007

Can someone give me the right syntax for using an index hint in a delete statement as below?

DELETE table1 WITH (INDEX('indexname_IX'))
WHERE datecolumn < @datevariable

I get this error message:

Incorrect syntax near the keyword 'index'.


I'm using Query Analyzer in SQL 2000 Enterprise.

Thanks,

Gerald

View 3 Replies View Related

Substring (Need Help) , Clue, Hint , Solution....?

Apr 10, 2002

Hi there,

I need to get back the actual characters (without trailing blanks) contained in a char(43) field.
So i tried:
- substring(fieldname,1,len(fieldname)) which yields a 43 char column
- using a variable that contains the actual length in
substring(fieldname,1,@nchar)) the same.
- tricking by concatenating the resulting string with a dummy like "" didn't
work either.
So apparently I am at a dead end.
Anybody a clue, hint or solution????
Thanks to all contributors

View 4 Replies View Related

Force Order Query Hint

Jun 8, 2001

We are discovering that adding Force Order to a query is substantially increasing performance. Any issues around using this ?

Craig

View 1 Replies View Related

Can You Place An Exclusive Row Lock Using A Hint?

Feb 21, 2000

Hi,

Is it possible to place an exclusive row lock when running a SELECT query by using a lock hint (or otherwise).

Basically, when a select statement is run against a table I don't won't any other users to read that row until it has been updated - at some later stage.

Any suggestions on whether this is possible would be welcome.

Thanks,

Karl

View 2 Replies View Related

Index Hint In Delete Statement?

Jul 12, 2006

According to what I see in BOL, the following should work:

delete

from dbo.tbl1 WITH (INDEX(idx_un01))

where tbl1_no = 1

Yet when I syntax check this I get:

Msg 1069, Level 15, State 1, Line 2

Index hints are only allowed in a FROM clause.

(Please ignore the fact that index hints are unnecessary / a bad idea / etc.)

View 5 Replies View Related

Renaming Databases With Grace, Any Hint ?

Aug 7, 2007

Hi,

I want to implement the following pattern (pseudo-code follows):





[for index in x different databases, where x is rather big]


create database MyDatabase_#{index}_Temp
launch a dedicated ssis package on this database
if I detect no error, proudly rename MyDatabase_#{index}_Temp to MyDatabase_#{index}_Last_Known_Good (drop the last_known_good first if it exist)

Later on, a consolidation process collect the data in Last_Known_Good versions of the databases.

My question: what is the simpliest way to achieve the rename operation (step 3) ?

I have tried an "alter database #{old_database_name} modify name = #{new_database_name}", but it works only once: once renamed, the database keeps the old mdf and ldf filenames, and the next create database will choke on this.

I have also tried to rename the logical filenames with ALTER DATABASE XXX MODIFY FILE (NAME = YYY, NEWNAME = ZZZ) but it doesn't work either.

I'd like to avoid specifying absolute mdf and ldf filenames myself, is it possible ?

best,

Thibaut

View 2 Replies View Related

NOLOCK Optimizer Hint On Iterator

Oct 25, 2006

An interesting discussion yesterday. One of the programmers asked about the use of the NOLOCK optimizer hint with an iterator table aka table of numbers. His comment was that this optimizer hint was not efficient. Rather than give a knee-jerk response I thought it would be better to ask. The main circumstance is that the iterator table is completely static with a fill factor of 100%. My purpose is to eliminate lock contention if I can.

Are there reasons to not use the NOLOCK hint in this case to potentially improve performance?





Dave

View 6 Replies View Related

Comment Thread For This Forum's Hint Sticky

Sep 27, 2005

My God! What happens if I miss a step, or put it in a different order??? I know I can specify ORDER BY StepID, but what about a missing step? I do have "missing ranges" script, but posting questions filtered through the script process may become a full-time job in itself...What to do, what to do...

View 14 Replies View Related

Locking Hint Problem On Multi-servers

Jul 20, 2005

Hi All,I want to lock 2 tables on 2 servers using TABLOCKXhint. These tables function as semaphores in myapplication. It means when the tables are lockedthen other users will not be able to access themand automatically they can not continue their works.I have tried using the following code, but itdoes not work. I always got the error :"Cannot specify an index or locking hint fora remote data source" on the select command.begin transelect * from server1.accounting.dbo.semtabwith (tablockx) where fprefix = '000'select * from server2.accounting.dbo.semtabwith (tablockx) where fprefix = '000'--commit tranThe error will disappear if I remove the servername, like this :select * from accounting.dbo.semtabwith (tablockx) where fprefix = '000'But, it does not meet my requirement.It only locks one table on one server(default).Please help meThanks in advanceJohn S.*** Sent via Devdex http://www.devdex.com ***Don't just participate in USENET...get rewarded for it!

View 9 Replies View Related

Parent Child Relationship Column Hint?

Feb 22, 2007

I've got a dilemma which I hope someone has a solution to.

Let's say we're building a data mining model to predict aircraft reliability. In the training table we've got a column (among many others) with a unique aircraft ID, and then a column for the type (737,747) and then a column for the series (100,200,300). I.E. A 737-800 series would be "737" and "800".

There is in essence a parent-child relationship between these 2 columns. 737's should share a common set of reliability factors, and then those factors might be further defined by the series number (for instance, the 737 might have very reliable radar except for the 500 series). The series is analogous to what model year a car is. What I want to make sure doesn't happen is for the system to correlate a 747-400 and a 737-400 because they are the same series. They are totally independent if the model number is different.

My only idea was to merge the columns and have a single value "737-100". But it would seem then that the model won't have any idea that a "737-100" and "737-200" should have a lot more in common than a "737-100" because the values will be completely different.

I was hoping to find some sort of parent-child hint in the column properties but found none.

What solutions have other people tried? It sure seems that there should be an elegant solution for something like, but I'm missing it.

Geof

View 3 Replies View Related

SqlServer 2005 + Cluster =&&> Very Slow, Any Hint ?

Apr 25, 2007

Hello

we have two SqlServer 2005 in cluster. The machines act very slow (although the CPU load is low) as soon as we achieve one of these operations:
- drop / create database
- restore database

We achieve those operations through the SqlServer Browser or via sqlcmd.
Everything else is running smoothly.

Is there any known reason on why it can be so slow ?

best regards

Thibaut

(hope this is not too OT, but could not find any cluster-specific forum).

View 6 Replies View Related

Replication :: Ability To Use Query Hint In Transactional Filtered Articles

Jul 22, 2015

I am setting up filtered replication(tran repl) for a table that is 2+ TB in size. The filtered rows are less than 1% of total size.When I run the snapshot, sometimes it complete in 27 mins(I have already optimized the snapshot agent profile) and sometimes it runs for ever. Mostly it runs forever, so the chances of it finishing soon are really very less.I have infact created filtered index just to cater to the query in the filter i.e. on the filter predicates. The reason its flipping flopping is due to the incorrect plan that it chooses. I can force the right index and the filtered query runs just fine but. I cannot use the query hints when I am adding the filter in replication as its not allowed.

I then went ahead and created the plan guides to force the best plan. But the plan guide was not used because even if there is a single space in the actual query that replication runs in the background the plan guide will not be used(testing on plan guides has proved this). The query needs to be ditto same including whitespaces and carriage returns. I then ran profiler and found that there is a view that replication creates and executes to extract the filtered rows and BCP it. Got the text of the view and created the plan guide on it but it was still not used because sp_helptext output seems to be different than what is actually being fired by replication internally.

Further, I collected the verbose log with level 2 and tried to find out if the main query shows up there with no success.

(a) I can't use the plan guide because I do not know the exact syntax(I mean I have the query but I do not know the white spaces, carriage returns, etc) and

(b) I cannot use query hint while filtering the article.

1. I cannot afford to have downtime.
2. I cannot use backup and restore option either.

View 5 Replies View Related

Stuck With Login Failed For User XxxxASPNET Error, Need A Hint Please

Jul 11, 2006

Hi,

I am stuck with that error when running my ASP.NET application on my production server for many weeks now and still don't have a complete solution to that problem.

I formerly posted that thread and read that other thread without success, so as I have made a few progress in delimiting the problem I am posting this new thread with the hope somebody will finally be able to help me.

To summarize:

1) I have developed an ASP.NET application,
- on a Windows XP Pro SP2 computer
- with VS studio 2005 Dev and included SQL 2005 engine
- this application works fine on the dev computer

2) I have deployed the application on a production server which is:
- a Windows 2000 SP 4 computer
- with SQL Express SP1 with Advance services installed

When I launch the prod application I have this error:
Login failed for user xxxxASPNET

I have found that I can bypass this error by doing the following:
1) manually attach my .mdf database with SQL Server Management Studio Express and specifying the field Attached as with myDatabaseName (in place of the default fullPhysicalPath/myDatabaseName.MDF) then detach it
2) change the auto generated connection string in web.config file from
<add name="ConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|myDatabaseName.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
To
<add name="ConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|myDatabaseName.mdf;User ID=sa;Password=mySAPassword;database=myDatabaseName" providerName="System.Data.SqlClient"/>

That would have been an acceptable substitution solution but unfortunately my
application also uses the new Login and Webparts features of VS 2005 which implies the automatic creation of an ASPNETDB.MDF database by VS.
As I have no mean (or at least don't know how) of modifying the associated Connection String for that database (it does not appear in web.config) I cannot bypass the problem for it and thus the error still appears when the application try to use this database.

Please I really need help on this matter, I can provide any other useful information as needed (logs, sources ...)

View 4 Replies View Related

Warning - The Join Order Has Been Enforced Because A Local Join Hint Is Used

Dec 23, 2014

I have two select statements, in between select statement taking UNION ALL . I need to avoid the error

Warning: The join order has been enforced because a local join hint is used.

View 9 Replies View Related

DEADLOCKs While BCPin Using &"TABLOCK&" Hint

Apr 21, 2008

Hi,

*** Skip all and go to last 2nd para for main question ****

We have our custom ETL tool that loads data in SS 2005 Enterprise Vesion using BCP. We use '-h "TABLOCK"' table hint and '-b 10000' batch size options.

Prior to 2005 Enterprise version (2K and 2K5 Standard Versions), we use to maintain around 10 DBs with same schema/sps and views in each of the dbs.

Now, in Enterprise version we are maintaining one DB where all tables are partitioned by one column.

Multiple instances might run from different workstations. Here, I want to clarify you that no instance will load data pertaining to another partition.

But at the same time there will be other components running that will query the tables in a SELECT sql and all tables have NOLOCK table hint.

There can be multiple instances of this component running from different workstations. Again, none of the instance will not access data pertaining to another instance (including the component that is loading data)

I have no clue why we some times get deadlock issues when we run multiple instances of custom ETL tool for loading data and other component that just has select only sql.

More over I get deadlocks many times only in BCP, this is a puzzle to me because i use NOLOCK table hint. This is the only place where table is populated by data and data in table neither updates or deleted.

Can some one tell which of these below concurrent transactions will get conflicts and leads to dead lock?


bcping data into table of partition A
bcping data into table of partition B
deleting few rows of data from table of partition E
updating few rows of data from table of partition F
querying table of partition C
querying table of partition D


Thanks
- D

View 1 Replies View Related

(Select All) In Multi-select Enabled Drop Down Parameters Doesn't Work

Apr 29, 2008

Hello all,
I have two mult-value parameters in my report. Both of them working with selecting one or more values. But, when I test using "(Select All)" values for both parameters , only one parameter works. The "available values" for these two parameters are both from the data set.

select distinct ProductType
from Product
order by ProductType

Any suggestion? thx


View 12 Replies View Related

DB Engine :: Unable To Select Data From A Table Even After Providing Select Access

Aug 28, 2015

I am unable to the access on table even after providing the SELECT permission on table.

Used Query by me :

Here Test is schema ; Card is table ; User is Satish

To grant select on Table

GRANT SELECT ON TEST.Card  TO satish
Even after this it is not working, So provided select on schema also.
used query : GRANT SELECT ON SCHEMA::TEST  TO Satish.

View 8 Replies View Related

SELECT-Using Correlated Subqueries: Just Name In Results &&amp; 0 Row Affected In One Of MSDN2 SELECT Examples

Jan 11, 2008

Hi all,
I copied and executed the following sql code in my SQL Server Management Studio Express (SSMSE):
--SELECTeg8.sql from SELECT-Using correlated subqueries of MSDN2 SELECT Examples--

USE AdventureWorks ;

GO

SELECT DISTINCT Name

FROM Production.Product p

WHERE EXISTS

(SELECT *

FROM Production.ProductModel pm

WHERE p.ProductModelID = pm.ProductModelID

AND pm.Name = 'Long-sleeve logo jersey') ;

GO

-- OR

USE AdventureWorks ;

GO

SELECT DISTINCT Name

FROM Production.Product

WHERE ProductModelID IN

(SELECT ProductModelID

FROM Production.ProductModel

WHERE Name = 'Long-sleeve logo jersey') ;

GO

=========================================
I got:
Results Messages
Name o row affected
========================================
I think I did not get a complete output from this job. Please help and advise whether I should search somewhere in the SSMSE for the complete results or I should correct some code statements in my SELECTeg8.sql for obtaining the complete results.

Thanks in advance,
Scott Chang

View 5 Replies View Related

Reporting Services :: Select Text Field Dataset Based On User Select Option?

Aug 4, 2015

I have a report that uses different datasets based on the year selected by a user.

I have a year_id parameter that sets a report variable named dataset_chosen. I have varified that these are working correctly together.

I have attempted populating table cell data to display from the chosen dataset. As yet to no avail.

How could I display data from the dataset a user selects via the year_id options?

View 4 Replies View Related

How To: Create A SELECT To Select Records From A Table Based On The First Letter.......

Aug 16, 2007

Dear All
I need to cerate a SP that SELECTS all the records from a table WHERE the first letter of each records starts with 'A' or 'B' or 'C' and so on. The letter is passed via a parameter from a aspx web page, I was wondering that someone can help me in the what TSQL to use I am not looking for a solution just a poin in the right direction. Can you help.
 
Thanks Ross

View 3 Replies View Related

Multiple Tables Select Performance - SQL 2005 - Should It Take 90 Seconds For A Select?

Dec 4, 2007

I have a problem where my users complain that a select statement takes too long, at 90 seconds, to read 120 records out of a database.
The select statement reads from 9 tables three of which contain 1000000 records, the others contain between 100 and 250000 records.
I have checked that each column in the joins are indexed - they are (but some of them are clustered indexes, not unclustered).
I have run the SQL Profiler trace from the run of the query through the "Database Engine Tuning Advisor". That just suggested two statistics items which I added (no benefit) and two indexes for tables that are not involved at all in the query (I didn't add these).
I also ran the query through the Query window in SSMS with "Include Actual Execution Plan" enabled. This showed that all the execution time was being taken up by searches of the clustered indexes.
I have tried running the select with just three tables involved, and it completes fast. I added a fourth and it took 7 seconds. However there was no WHERE clause for the fourth table, so I got a cartesian product which might have explained the problem.
So my question is: Is it normal for such a type of read query to take 90 seconds to complete?
Is there anything I could do to speed it up.
Any other thoughts?
Thanks

View 7 Replies View Related

Remove Select All Options From Multi Select Parameter Dropdown

Jun 8, 2007

Hi All



I am using SQL Server 2005 with SP2. I have multi select parameter in the report. In SP2 reporting services gives Select All option in the drop down.



Is there any way I can remove that option from the list?



Thanks

View 4 Replies View Related

Select Statement Problem - Group By Maybe Nested Select?

Sep 17, 2007

Hey guys i have a stock table and a stock type table and what i would like to do is say for every different piece of stock find out how many are available The two tables are like thisstockIDconsumableIDstockAvailableconsumableIDconsumableName So i want to,Select every consumableName in my table and then group all the stock by the consumable ID with some form of total where stockavailable = 1I should then end up with a table like thisEpson T001 - Available 6Epson T002 - Available 0Epson T003 - Available 4If anyone can help me i would be very appreciative. If you want excact table names etc then i can put that here but for now i thought i would ask how you would do it and then give it a go myself.ThanksMatt 

View 2 Replies View Related

Result Sets Using Select In Query Anlyzer Vs BCP Vs Select Into

Jul 9, 2002

When I run simple select against my view in Query Analyzer, I get result set in one sort order. The sort order differs, when I BCP the same view. Using third technique i.e. Select Into, I have observed the sort order is again different in the resulting table. My question is what is the difference in mechanisim of query analyzer, bcp, and select into.
Thanks

View 1 Replies View Related

Implement SELECT Starement On A Results Of Prev SELECT

Dec 22, 2002

Hi,
im getting from my first select a list of pairs of codes (let say the codes r of products.)
so i have something like:

FirstCode SecondCode
1 1
2 5
4 2
... ...
now i want to get the name of each product so it whould be like:

FirstCode,FirstName,SecondCode,SeconeNam

the names stored in other table.
how can i do it?
thanks

Dovalle

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved