Problem With Like @varible%!

Dec 20, 2007

Hi,

I'm trying to create a page in a web browser where users can type the name of a company in a text box and to get details of the company. I can hard code like the below example and it brings up the details i'm looking for.


The problem is when I try to replicated this with a stored procedure it doesn't work.

Thanks for any help in advance,



Code:

select * from company
where companyname like 'companyx%'






Code:

procedure company_detail_search

(@company nvarchar)

as

select * from company
where company @comapany%

View 2 Replies


ADVERTISEMENT

Varible Passing

Apr 26, 2006

Hi:

When i try to execute the following stmt using sqlcmd, it is giving me error.

c:>sqlcmd -i "c:sqlconfigDDLLogging.sql" -v LogDir='c:sctclogs'

the error is
Sqlcmd: ':sctclogs'': Invalid argument. Enter '-?' for help.

but when i pass just -v LogDir='csctclogs' it work fine.

The problem is with ":" when i put colon it throws error.

Any help to execute the above command would great.

Thanking you,

Best regards,

Kumar

View 9 Replies View Related

DTS- Add Global Varible's Value To Text File

Sep 7, 2005

Hi, I have a DTS which has a connection, 3 destination text files and aProcess execution job which runs a simple batch file to concatenatethis 3 files into a 4th text file "Endeud.txt". I added an activeXcommand Job to input a date which is saved in a global variable. Ineed to add this date at the end of the Endeud.txt file (The date wouldbe the last line of Endeud.txt. How can I do this?

View 1 Replies View Related

Drop A Database When The Name Is Supplied As A Varible

Jan 17, 2008



I have created a stored procedure that will back up a database to a file then restore the database into a new db. The stored procedure accepts 2 parameters that determine the name of the old DB to be backed up and the name of the new DB to be created. The only problem now is that when you specify the name of a database that already eixists, the restore fails. I want to add an if statement that would check to see if the new db supplied exists, and if it does drop it before running the restore.

I thought the following would work but it does not




Code Block
declare @DB nvarchar (50)
set @DB = 'LDRPSsmap2k'

IF EXISTS (SELECT name FROM sys.databases WHERE name = @db)
Drop Database @db


I get When i run this

Msg 102, Level 15, State 1, Line 7

Incorrect syntax near '@db'.

View 3 Replies View Related

Error While Assigning Value To The Varible In Execute SQL Task

Jun 21, 2007

Hi,

In Execute SQL Task, I'm facing following error when Result Set assigns value to the global variable.

SSIS package "Package.dtsx" starting.Error: 0xC002F309 at Execute SQL Task, Execute SQL Task: An error occurred while assigning a value to variable "IDCount": "Value does not fall within the expected range.".Task failed: Execute SQL TaskWarning: 0x80019002 at Package: The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.SSIS package "Package.dtsx" finished: Failure.

My SQL statement is "Select count(*) as AliasNm from <TableName>" and my Result Set type is Single Row.

I mentioned in the Result Set's Result Name as AliasNm.

Help me to resolve this error.

Thanks in advance.

Suku

View 17 Replies View Related







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