|
Yes that's of course a possibility, which means that I parse out the spaces behind the real string by hand. But I wondered if there wasn't any other possibility or if I made something wrong when getting this value from the database. But it seems that I made it correctly... that's just strange...
Anyway thank you
|
|
|
|
|
Hey.
I am currently working on my database for users of a site I am building. I have a stored procedure that takes parameters to fill in a users table - these are email, password and group. I then add the users credentials to a table depending on their group. I am using transactions so if there are any failures I can roll back.
My problem is that i set up an sqlCommand and add parameters to it, i then wish to use this same command but supply different parameters for the next stored procedure but I am told the paramater list is too large (makes sense) so do I remove the parameters supplied first? and if so how?
I am open to suggestions of different methods and their benefits.
Cheers
Dan
|
|
|
|
|
It's ok fixed it just used sqlparamter::clear() - silly error
|
|
|
|
|
Hi all,
i just want to know how can we programatically increase or decrease the number of parameters of a stored procedure that is stored in a DB.Let me explain it first
I am reading some distinct values from a table column and depending upon the rows returned i have to set the parameters of Stored proc accordingly.The table i am reading from can contain any no of tuples.
Help!!!
|
|
|
|
|
As far as I know you'd have to alter the proc to change it's parameters and you could do this programatically but at that point you might as well just do dynamic sql. Could you use a comma seperated list of values as parameters? Do have some example code for the stored procedure and what it's supposed to do?
|
|
|
|
|
The database is on server(sql server 2000).
The application (Windows application c#) run on the client pc's.
How can i update the data in the application when the data on server has been changed?
|
|
|
|
|
|
The database is on server(sql server 2000).
The application (Windows application c#) run on the client pc's.
How to use the SqlTriggerContext to update the data in the application when data on server has been changed?
|
|
|
|
|
Hi
can anyone plz tell me the query to access all the attribute names of one table only.
i'm working in Sql Server.
Saira
|
|
|
|
|
try this:
SELECT C.Name
FROM sysobjects O
JOIN syscolumns C ON O.ID = C.ID
WHERE O.Name = 'YOUR_TABLE_NAME'
|
|
|
|
|
select * from
or
select <field names=""> from <able name="">
eg
select * from emp
select empno,ampname,sal from emp
|
|
|
|
|
I use ExecuteReader to perform "SELECT * FROM tablename WHERE 0=1"
then I iterate across the fields returned in the DataReader.
You get names and datatypes, plus you can access both the .net datatypes and the internal datatypes.
Close the DataReader _after_ accessing the information.
This works for any data provider, not just SQL Server.
|
|
|
|
|
Hi ,
I had some problem with my select query.Let me explain you whole.
I had created dynamic query in my select query as i required performance.
My Select query is as below:
Select firstname,lastname,dob,ssn from person
where
(
firstname like 'abc%' and lastname like 'xyz%'
OR
firstname like 'ypx%' and lastname like 'por%'
OR
firstname like 'stup%' and lastname like 'rob%'
)
Now here i required one more field which is not available in
database table (person table).
Now that field is MatchType.Matchtype is used for
If user input of firstname and lastname is exactly matching with
database record then i have to write matchtype ='Exact Match'
if user input of first 3 character of firstname and lastname is matching
then i have to write Matchtype ='Potiential Match'
Now problem is that :
If i will write subquery like
Select firstname,lastname,dob,ssn,
(
Select
//some login which return Match type
) as Matchtype
from person
where
(
firstname like 'abc%' and lastname like 'xyz%'
OR
firstname like 'ypx%' and lastname like 'por%'
OR
firstname like 'stup%' and lastname like 'rob%'
)
If i can't write query like that becoz subquery should return only one
value.
so can somebody help me out here.??
If you have any question then let me know without hesitation.
Thankx a lot in advance.
regd,
montu3377
|
|
|
|
|
I'm not sure if I totally understand your requirements but would the following work.
Select
firstname
,lastname
,dob
,ssn
,case when (firstName = 'abc' and lastname ='xyz') or (firstname ='ypx' and lastname ='por') or (firstname ='stup' and lastname ='rob') then 'Exact Match'
else 'Potential Match'
end as [MatchType]
from person
where
(
firstname like 'abc%' and lastname like 'xyz%'
OR
firstname like 'ypx%' and lastname like 'por%'
OR
firstname like 'stup%' and lastname like 'rob%'
)
|
|
|
|
|
I need to migrate about a dozen databases from SQL Server 2005 running on (ComputerAboutToBarf01) to (ServerAboutToSaveTheDay01). Do I have to manually backup then restore each database or is there a utility out there that will do this for me? I tried it in the Management Studio but don't seem to see any point-and-click way to do it all at once.
|
|
|
|
|
Have you looked into using any stored procedures?
|
|
|
|
|
Pls anybody help me.
i hve to update a feild( say rcvd) in receivables table from taking the feild(amount) from allocation table. i give the query like this"
update receivables,allocation set rcvd=rcvd+amount where
receivables.no=allocation.no "
i want to know whether we can give 2 table name in update query if so then the syntax when i give the above i am getting error.pls help me its urgent
-- modified at 4:31 Saturday 20th January, 2007
|
|
|
|
|
|
try ...
update r
set
rcvd = r.rcvd + a.amount
from receivables r
join allocation a on a.no = r.no
|
|
|
|
|
I’m just starting to learn about database design and normalization, and from what I’ve learned so far, it seemed to me that it would be a good idea to several tables to define an “address” object.
What I mean is:
Instead of having a table called “Address” like:
__________________________
Address
• StreetAddressNumber
• StreetName
• UnitNumber
• ZipCode
• City
• County
• State
• Country
__________________________
I think it is better to have several tables such as:
__________________________
Address
• StreetAddressNumber
• StreetName
• UnitNumber
__________________________
ZipCode
• ZipCodeFiveDigit
• ZipCodeFiveDigit
__________________________
City
• Name
• County
__________________________
State
• Name
• Abbreviation
__________________________
Country
• Name
__________________________
But from what I’ve seen so far, nothing looks like this. Most of the designs I’ve seen have an “Address” entity with all the address information in the same table like the first table you see above.
Am I going too far with normalization? Is there a reason not to do what I’m doing?
Any thoughts?
Thanks in advance,
Silvio.
http://www.silvioribeiro.com
|
|
|
|
|
It is a bad idea to "over normalize". Although it increases flexiblility, it can seriously impact performance and maintainability. in your example, to get a complete "address" entity you would need a query that potentially joined all five tables (you are missing Primary keys and PK-FK relationships BTW). To add a new address you would need a potentially complex query that added new rows to possibly all 5 tables (complex because it would have to determine whether to use an existing row or add a new row). Logically, all of that information belongs to a single entity (an address) and belongs in a single table (I would not, however, break up Zip code into parts, but rather just have a single "postal code" field). You might, however, heve a separate table for "person" entities, and that would have a pk-Fk pointer to the address table, because two or more "persons" can share the same address.
Basically, don't normalize further than the 'entity' level, and keep the entities reasonably complete even at the expense of duplicate data.
|
|
|
|
|
Thanks so much Rob, your answer was very helpful as it covered everything that wasn’t clear to me. I started to learn Visual Basic about 2 years ago and found out that without knowing at least the basics of database design everything can be a lot harder.
Also, the fact that I don’t work as a programmer, and don’t have anyone to ask questions doesn’t help me at all.
I’m constantly trying to learn everything on my own. Not easy!
Thanks a lot,
Silvio.
http://www.silvioribeiro.com
|
|
|
|
|
I have a database that has the final three combined in a table called Jurisdiction. Every entry in the Address table has a reference to an entry in the Jurisdiction table, too. But it depends upon the usage. In my case I have other uses for jurisdictions, besides addresses. Things like holidays, for example.
Chris Meech
I am Canadian. [heard in a local bar]
I agree with you that my argument is useless. [Red Stateler]
Hey, I am part of a special bread, we are called smart people [Captain See Sharp]
The zen of the soapbox is hard to attain...[Jörgen Sigvardsson]
I wish I could remember what it was like to only have a short term memory.[David Kentley]
|
|
|
|
|
I have table "tasks" that is recursive--tasks can have subtasks. The table has an ID and a ParentTaskID.
Is there a way to write a query to recurse through all the subtasks of a particular task?
Thanks!
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
If I understand your problem correctly, than the only way I can think of to do this would be in your code...not in a single SQL statement. You would have to put the SQL select in a loop that would keep checking for a record until it finds one that doesn't have a parent task.
Hope this helps.
|
|
|
|