|
hi Guys
i have a Stored procedure
Create Procedure [prcLoginv]
(
@User_name varchar(20),
@U_Password varchar(23),
@Results int Output
)
IF EXISTS (Select * from Login
where Username = @User_name and U_Password = @U_Password)
return 1
else
return 0
i get the following Error
Msg 156, Level 15, State 1, Procedure prcLoginv, Line 8
Incorrect syntax near the keyword 'IF'.
what is wrong
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi,
Take the SELECT statement to a separate statement and take the return values (for example username or COUNT) to a local variable and then test the variable value in IF statement.
Mika
|
|
|
|
|
Given that he has a syntax error (code won't even compile) how will checking the logic of the stored procedure help?
|
|
|
|
|
That's true, didn't notice the missing AS keyword .
|
|
|
|
|
You are missing the keyword AS
CREATE PROCEDURE Name
@parameters parameter_types
AS
BEGIN
-- Code goes here.
END
|
|
|
|
|
Thank you guys,
But how can i forget such small thing.
Thanks a lot
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
It's pretty obvious that password hashes for SQL Server 8.0 and 9.0 are different. So when migrating a server from SQL server 2000 to SQL Server 2005, everyone's password pretty much gets jacked.
Is there a way to login to a SQL Server 2005 instance using SQL Server 200 credentials?
I've tried specifying the provider and driver in my connection string for my ADO objects but get an error thrown back at me saying that the "provider" keyword is not recognized.
|
|
|
|
|
So here's the story. I was wrong about the hashes.
But, 2005 uses case sensitive passwords by default. So when our vendor's application converts all passwords to upper before connecting, of course it'll do the same when it creates the users.
So I have the misfortune of being an idiot and writing supplementary applications for badly designed software. Yay for me, and all I have to do now is edit a few libraries.
|
|
|
|
|
Hello
How does one go about debugging Transact SQL code in MS SQL 2005.
The instance on which I wish to debug the tSQL, is running under the LocalSystem account.
Thanking the replier in advance
ChristiaanS
|
|
|
|
|
You can use Visual Studio for debugging. Select the procedure from Server Explorer and "Step Into Stored Procedure"
Mika
|
|
|
|
|
|
You're welcome
|
|
|
|
|
iam passing a string example "hi this is john" then how i can i check whether the string john is there in the string or not in given string .
|
|
|
|
|
Just a sample how can you implement in your real data.
DECLARE @val AS VARCHAR(255)<br />
SET @val='hi this is john'<br />
<br />
IF(SELECT CHARINDEX('john',@val))>0<br />
BEGIN<br />
PRINT 'exists' <br />
END<br />
ELSE<br />
PRINT 'doesnt exists'
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
Hi
I really need some help here. I’m about to introduce SSIS packages where I work. Basically this package needs to import data into SQL tables. I have created all the necessary connections – from a flat file as a data source to a ole db connection. The flat files names stays the same but the suffixes changes on a daily basis.
Eg: imp.1 for day 1 then imp.2 for day 2 and I can’t be changing file names on a daily basis.
How may I tackle this one?
Kicza
|
|
|
|
|
Is there not a fornext object in SSIS that you can read each file in. Test the file pattern using a script and process or dump the file.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Sometimes, a low tech approach is the way to go ...
How about this:
You will need 2 directories,
1 for where the files will be placed on a daily basis
2 a work area where you can rename "today's" file to be processed.
You can use a .bat file or .vbs script to check directory 1 for a new file, take that new file and copy/rename it to the work area with the desired standard file name convention and kick off the SSIS import. After the processing you could go back to directory 1 and rename the file to something like "myfile.day1.done".
You have alot of flexibility with writing .vbs scrips and scheduling them for execution.
Just a thought.
David
|
|
|
|
|
Ok, this isn't so much a "I need help" question as it is a "what do you think of this" question. I'm building a .net desktop app that accesses it's database through a web service. I need to implement a way for my users to upload large data files into the database on demand. The data files are generated by third parties and their format changes quite frequently. When these files are uploaded, only some columns from the files are uploaded into the DB tables. Now, I've looked at several options and here's what I've decided on. I'm going to create a DTS package and job for each import file and I'm going to fire it off using sp_start_job. I'm then going to poll the job's status using sp_help_job. Does this sound reasonable or can anybody think of a simpler way? It's gotta be flexible and easy to update without having to recompile/redistribute code, which is why I'm going the DTS package route.
|
|
|
|
|
Nasty, ugly painful SOB of a thing. I have grown to dislike most of MSs ETL products, Biztalk and SSIS. We have a similar problem which requires the ETL to handle additional columns in a data file that is uploaded daily. SSIS will choke on this and changing a package, redeploying etc AFTER it has choked is not an option.
Our solution.
The package reads the first line of the file where the column headers are and checks against the target table in SQL. All cols are varchar 500. If there is a new column (it always grows) SSIS drops the target table and passes the column names into a stored proc to recreate the table (some column names are duplicated and this is handled by the proc).
The package then bulk copies the data into the target table, it is guaranteed to work because of the previous process. I then have a proc to do the transforms into the production database. I find changing a proc to be easier than a package.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I agree. For some reason (I believe that the reason is between the chair and the keyboard ) I often find it difficult to implement tasks with "advanced" functionality with SSIS. Usually I use stored procedures and if T-SQL cannot provide enough functionality I typically create an assembly using C# and add that to the database. This way I can get more reusable functionality to the place where it's actually needed (=DB).
I think that the problem with SSIS for me is that logic is easily scattered to different modules and it's more difficult to understand later or maintain. Also SSIS is not so powerful that it could be used as "programming platform".
However, what comes to Analysis Services I find SSIS usable. It's quite easy to load data from OLTP to cubes so I haven't totally discarded it. Also simple data pumping tasks seem to work fine.
What comes to original question, I think your idea is good and if you don't have any difficulties implementing this using SSIS, you're safe.
Mika
|
|
|
|
|
Mika Wendelius wrote: if you don't have any difficulties implementing this using SSIS
You've got to be joking, took me 3 days and more googling than I like to think about to identify the shortcomings and work around them. I still prefer DTS!
We were in the position of needing to move an SSAS database from the default (also want to stripe it across drives) and went to out outsource DBA support (IBM)for help, "sorry we have no experience in SSAS" WTF. SSAS presents it's challenges as well.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I think I wrote it badly. I was trying to refer to original FyreWyrm's question, not to your case.
|
|
|
|
|
Hi,
I have a column in (say) database 1, and another column in (say) database 2.
How would I go about copying all the values from the database 1 column into the database 2 column?
Cheers,
|
|
|
|
|
Databases do not have columns, they have tables, are you tlaking about copying a table from 1 DB to another?
What database, SQL, Access, MySQL.....
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Databases do not have columns, they have tables, are you tlaking about copying a table from 1 DB to another?
Your right, sorry. They are columns in tables within the two databases.
Im using Microsoft SQL Server Management Studio.
Hope thats enough info.
Cheers,
|
|
|
|