Separate An And/Or Parameter
Jul 23, 2005
I want a user to be able to search for names in a table of clients
using a single parameter, but be eable to use "and" or "or" IN the
parameter.
Like this:
@NameSearch nvarchar(100)
AS
DECLARE @PartA nvarchar(100), @PartB nvarchar(100)
CASE When @nameSearch Like '%' + ' OR ' + '%'
SELECT @PartA =(how do I get what's to the left of "OR" or "AND")
SELECT @PartB (how do I get what's to the right of "OR" or "AND")
SELECT
c.UniqueID,
c.LastName
FROM
dbo.tblClients c
WHERE
c.LastName = @PartA
OR
c.LastName = @PartB
CASE ELSE
SELECT
c.UniqueID,
c.LastName
FROM
dbo.tblClients c
WHERE
c.LastName = @NameSearch
View 14 Replies
ADVERTISEMENT
Feb 26, 2007
How to export report to separate excel sheet? Does reporting service support it? Can I export report to separate sheet by parameter?
Thank you!
View 1 Replies
View Related
Feb 15, 2012
I am trying to add 2 separate columns from separate tables i.e column1 should be added to column 2 when inserted and I want to use a trigger but i don't know the syntax to use...
View 14 Replies
View Related
Feb 10, 2007
How can i format my query so that each piece of data appears on a new separate line? Is there a command for a new line feed? does not work.
thanks.
For example:
a: data
b: data
c: data
a: data
b: data
c: data
View 6 Replies
View Related
Nov 9, 2005
Hi to all of you,
I am new to SQL I have a problem that I can’t solve.
I have a column with Surname and name (SMITH, James) in one table with data I just need to separate in two columns in one Surname in the other one Name I know how to unite two columns using substrings but not to separate in two columns.
Help is highly appreciated
View 4 Replies
View Related
Aug 18, 2005
Hi guys,
How can I separate the data that is alpha numeric in type?
FloorNumber
8A
8B
8C
11A
11B
12
13
14
15A
I need to separate the 8 from A in 2 columns just like ....
UnitLevel UnitCode
8 A
8 B
And if the floor numbers do not have "letters" then let it be.
Thanks.
View 2 Replies
View Related
Jul 19, 2007
Hi
I have a column say “Col_1� in which “=>� is used as separator.
Col_1 data is as follows
House => Street => Area => City => Country =>
I want to create separate columns for House, Street, Area etc from Col_1 using “=>’ separator.
Please advise how?
Thanks
Jawad
View 1 Replies
View Related
Jul 24, 2007
I want to know if 64-bit SQL Server 2005 is a separate install. I have been provided with SQL Server 2005 enterprise CD. I tried browsing through the folder but could not find 64-bit install.
I am assuming the CD I have is 32-bit because the system configuration check report had this message "64-bit ASP.NET is registered. Required 32-bit ASP.NET to install Microsoft Reporting service 2005(32 bit)"
The windows server I am trying to install is Windows Server 2003 Standard x64 Edition. I uninstalled the all the client and SQL Server 2005 install. Since my windows server 2003 hardware requirements are compatible for 64-bit SQL server 2005, I want to go ahead and install 64-bit SQL server 2005.
Any help will be greatly appreciated.
View 8 Replies
View Related
May 30, 2008
I need to do a inner join on tables from two separate databases. I understand that you can do this by using this type of syntax:
select a.col1, b.col2from db1.dbo.tab1 a, db2.dbo.tab2 bwhere a.col1 = b.col2however, how do I reference the two databases in the following code?
Thanks,
Tim
Function GetConnectionString() As StringDim ConnectionString As String = ConfigurationManager.ConnectionStrings("MainWeb").ConnectionString
Return ConnectionString
End Function
Using conn As New SqlConnection(GetConnectionString())
conn.Open()
Dim sql As String
sql = "SELECT CaskInfo.CaskID, CoCInfo.CoCName, AmendmentInfo.AmendmentName FROM CaskInfo INNER JOIN CoCInfo ON CoCInfo.CoCID = CaskInfo.CoC INNER JOIN AmendmentInfo ON AmendmentInfo.AmendmentID = CaskInfo.Amendment WHERE "For i = 0 To UBound(words)
If i > 0 Then sql = sql + " OR "
sql = sql + "(CoCInfo.CoCName + ' ' + AmendmentInfo.AmendmentName) LIKE '%" + words(i) + "%'"
Next
' lblResults.text = sql' Exit Sub
Dim com As SqlCommand = New SqlCommand(sql, conn)
Dim result As SqlDataReader = com.ExecuteReader()
Dim SearchResults As StringWhile result.Read()
SearchResults = SearchResults + result.GetInt32(0).ToString + " " + result.GetString(1) + " " + result.GetString(2) + "<br>"
End While
result.Close()
lblResults.text = SearchResults
conn.Close()
End Using
View 5 Replies
View Related
May 26, 2005
I have a data grid with dropdownlist.the dropdownlist is populated with datas wth a sql statement with 2 combined datamy sql : SELECT NAME + CAST(ID as CHAR(10)) FROM TABLE1When i select a value from the dropdownlist, i need to separate the data, name and id into different columnshow do i do it?Is there a way to manipulate the sql to do such a thing?
View 1 Replies
View Related
Jul 21, 2000
How do you select data from 2 separate databases residing on 2 servers?
Is there a way?
Angel
View 1 Replies
View Related
Feb 8, 2001
Has anyone implemented SQL 7 on a cluster(NT 4 Enterprise). It has been running for about 1.5 years with no problems. However, I now wish to manage the transaction log on a separate disk to the data, to increase performance.
I think I would need to create a new Disk resource on the cluster for the transaction log. But am not sure of the consequences during failover.
Has anyone done this, so that the disks containing the transaction log also failover.
There are some articles at the microsoft site, but none deal with managing the transaction log separately on a Cluster.
View 4 Replies
View Related
Nov 2, 1999
I want to keep Win98 and my files intact on my C drive then install another hard drive and install MS Back Office (NT 4.0, SQL 7.0) on the new drive. When I want to switch operating systems, I want to restart in dos, go to the new drive and launch NT. I can't dual boot because I have FAT32 file system on my C drive. Has anybody tried this? Do it work?
View 1 Replies
View Related
Mar 3, 2001
I am new to T-SQL and triggers
Any help will be appreciated
I am trying to change this code to insert firstname, surname (taken from employee table on db A) to firstname, surname on customer table of DB B but also create cust_id on customer table and DB B. currently I am getting all rows of customer.cust_id filled with the same data whenever a new data is inserted into (firstname,surmname of employee table)
Create trigger gen_cust_id ON employee for insert
AS
Update customer SET cust_id =( SELECT
Replicate('0',(4-DATALENGTH(CONVERT(varchar(10),i.id))))
+ Convert (varchar(10),i.id)
+ Substring(i.lastname,1,3)
+ Substring(i.firstname,1,1)
from employee C INNER JOIN inserted i on i.id=c.id)
from employee C INNER JOIN inserted i on i.id=c.id
Saad
View 2 Replies
View Related
Sep 18, 2006
I have a table with accountid and labtype
However inside of the labtype is data separated by semicolons like below
GIV;APS;LSL. What would be the best way to return this data as multiple rows such as
acctid lab
100 GIV
100 APS
100 LSL
Thee may be from 1-10 values in the labtype field
View 1 Replies
View Related
Feb 28, 2002
I recieved a SQL Server table that was supposed to have just the firstname in a field, but actually has firstname and middle name.
Example David Michael
Carol Anne
Is there a way in a query to look for the blank space and separate the names?
View 2 Replies
View Related
Oct 13, 2015
I simply need to separate the string for each row by the & character and then I'm assuming i ll be able to COUNT and GROUP BY the occurrences of each separate value in order to find the most commonly used inputs.I have a column Variables in the table Functions, that contains a string of values separated by the & character that shows the inputs each student inserted into a function.
How would I go about splitting that string without the use of a function or stored procedure and the find the most commonly used variables? (I was thinking the latter part could be easily solved with a COUNT(*) and appropriate GROUP BY.)
Example of data:
StudentID FunctionName Variables
1 Example1 Var1=10&Var2=xy&Sign=True&Role=False
View 2 Replies
View Related
Jun 8, 2008
Hi,
i have a web application (iis 6) and a databasae. web application is using windows authentication. when iis and the database are on the same server the application is running fine and can be accessed from clients. but when i moved the database to another server it stated giving the error([DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied ) only from clients from IIS server its working.
- when using in iis windows basic authentication its working but integrated Authentication giving the error.
- web application pool is using a domain/user that has access to the database
- All servers are win 2003
<add key="ConnectionString" value="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=EFILING;Data Source=RPDHO07;"/> i tried also to use the username and password in connection string same problem
Please help this puzzled me aloooot :@
View 6 Replies
View Related
Apr 29, 2014
I have two tables
Books
-BookID
-CustomerID
Magazines
-MagazineID
-CustomerID
How would i write a single sql statement where i can get that counts how many bookIDs are listed for each custoemrID and how many magzaineIDs are listed for each customerID and have it return one table that looks like this:
CustomerID, BookCount, MagazineCount
View 3 Replies
View Related
Mar 2, 2015
How to separate column FullName to three column LastName, FirstName, and MI? Sample of FullName - Smith, John P.
View 4 Replies
View Related
Mar 15, 2006
In Enterprise Manager, is there a way to group Databases into Separate folders?
View 6 Replies
View Related
Oct 5, 2007
declare @filter varchar(100)
set @filter = '10,''firststring''||10,''secondstring'''
declare @tbl table
(id decimal,
name varchar(20))
insert into @tbl values (substring(@filter,0,patindex('%||%',@filter)))
hai in the above exmaple, i recieve input value (@filter) as concated string . pipeline(||) is my delimiter..
i want to split the string based on this delimater and need to insert into @tbl..
There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
What is the error in this. i believe i can do this way to insert to concatinated values.
Help pls
View 6 Replies
View Related
Nov 23, 2005
I have two databases with multiple tables. Same tables same fileds.Both databases contain records, but they should not match each other.(I will run a report for matches before this and delete any data thatis not current to ensure this is the case)How do I go about moving data from one of the databases to the other inorder to create a single database with all the data? Unfortunately mySQL is limited and I cannot image how I would work around the uniqueids. Append or update maybe?Thanks in advanceAndrew
View 1 Replies
View Related
Oct 12, 2007
Hi,
can anyone tell me, how does Reporting Services work in the following scenario:
There is a report with multiple pages (eg. 50 pages). The user runs the report.
Question: What is transferred from the Reporting Services server to the client desktop ? all pages or just the first one ?
Background> I don't want to let the user wait until all pages are received (because he may be interested only in the first one and the jump to the last one and that is all he wants to see)
Any ideas are appreciated.
View 1 Replies
View Related
Dec 21, 2006
I'm fairly new to RS and have a problem.
I have a query that pulls information on people, courses they have taken, their score and so on. I have a date parameter setup so I can run it by year. Everything works ok on the query side, I get all the information I need on all the people and the courses they have taken. However, when I run the report, I do not get a separate page for each person and their relative information. The first page shows the first name and the rest of the 700 pages list all the courses and other information, with no break. How do I render the report so that I can get a separate page(s) for each person and their specific info? I can glady provide more info/code if need be.
Bill
View 8 Replies
View Related
Jun 27, 2006
I'm writing an application where I have a class which for example represents a User and I have a UserDAO class which holds all the calls to the database. When I'm trying to create a user, I call my User class pass in the username and password from the login box. Then in my UserDAO I pass these details to a stored procedure to query the database. In this method in the UserDAO I open a SqlConnection call the stored proc and set the results to a SqlDataReader. Then I return this SqlDataReader object which I've created.In my User class the method I populate the user class properties with create a SqlDataReader based on the method on the UserDAO method.My problem is first how can I close the connection I originally created in my UserDAO, as I'm returning a SqlDataReader object I can't close my SqlConnection object before returning in the method. And I can't close the SqlConnection in my User class.Is there another way to separate all my DAO methods in a separate (UserDAO, SecurityDAO etc), but call them in my main classes (User, Security etc).ThanksStephen
View 1 Replies
View Related
Feb 5, 2008
Hello there,How can i take data out of my database, put them into a textbox and then separate with a comma..An example:----------------------------------| column Email || mail1@email.com || mail2@email.com || mail3@email.com |----------------------------------Put them into a textbox and separate with a , (comma)-------------------------------------------------------------------------------------| mail1@email.com, mail2@email.com, mail3@email.com |-------------------------------------------------------------------------------------Anybody who know how I can do that? :S
View 4 Replies
View Related
Jun 18, 2008
I have two SQL queries that I would like to combine. Each query is dependent on the same table, and the same rows, but they each have their own WHERE statements. I've thought about using some JOIN statements (left outer join in particular) but then I run into the problem of not having two separate tables, and don't see where I can put in two separate WHERE statements into the final query. I've read into aliasing tables, but I'm not quite sure how that works (how to put it into code or a JOIN statement) , or if it would solve my question. Do you have any ideas or examples of how to solve this scenario?
View 9 Replies
View Related
Jan 25, 2006
My question is setting up master detail pages using stored procedrues. In the tutorials C# Master-Details (Seperate Pages) example they use the following code for the master page for the navigation.
<asp:HyperLinkField HeaderText="View Details..." Text="View Details..." DataNavigateUrlFields="au_id" DataNavigateUrlFormatString="DetailsView_cs.aspx?ID={0}" />
The call to the Details Page DetailsView_cs.aspx uses the following code
<asp:SqlDataSource ID="SqlDataSource1" Runat="server" SelectCommand="SELECT dbo.authors.au_id, dbo.titles.title_id, dbo.titles.title, dbo.titles.type, dbo.titles.price, dbo.titles.notes FROM dbo.authors INNER JOIN dbo.titleauthor ON dbo.authors.au_id = dbo.titleauthor.au_id INNER JOIN dbo.titles ON dbo.titleauthor.title_id = dbo.titles.title_id WHERE (dbo.authors.au_id = @au_id)" ConnectionString="<%$ ConnectionStrings:Pubs %>"> <SelectParameters> <asp:QueryStringParameter Name="au_id" DefaultValue="213-46-8915" QueryStringField="ID" /> </SelectParameters> </asp:SqlDataSource>
I can replicate the example calling the detail page but I am unable to make the detail page work when using a stored procedure as the asp:SQLDataSource. Using the above sql code as a stored procedure in the <SelectParameters> I am not able to return the data set using either asp:QueryStringParameter or asp:Parameter as I have built other forms using stored procedures and have tested the procedure and know that it works. Can someone point me in the right direction.
Thanks
View 2 Replies
View Related
Jan 5, 2001
We have some tables that we have spread across two databases. The segregation isn’t essential, but the entities involved were disparate enough that we thought it made sense. However, our client app regularly & frequently requires information that can only be answered by queries to tables in both databases. It has been suggested that segregating the tables as we have introduces a performance hit. At this stage, it would be relatively easy to re-combine the tables into one DB.
View 1 Replies
View Related
Sep 26, 2000
Hi everybody,
On the time of installation SQL Server asking me where I wont to locate the DATA files and the PROGRAM files. It’s giving to me choice to put database AND log files on one disk and program files on separate. But what about to separate LOG and DATA files. I have RAID1 especially created on F: drive for LOG files and RAID 5 on E: for DATABASE files. When I have to separate that if not on the time of installation? How I can do that?
Thanks,
Miriam
View 3 Replies
View Related
May 16, 2003
Hi all smart people,
TableA has a column called address.
values for example:
address
--------------------------------------
107 31 118th street apt#2
1717 east 16th st apt 3e
attn: sales dept po box 398
TableB has two fields called address1 and address2.
Values need to be in there:
address1 address2
------------------------------------
107 31 118th street apt#2
1717 east 16th st apt 3e
attn: sales dept po box 398
How can I make it happen? Please help.
Thanks,
Jannat.
View 2 Replies
View Related
May 10, 2005
with varchars having a max of 8000 bytes and partly because of the coder before me, I'm stuck with using text. the text has a maximum of 30,000 characters, i've tried everything to try to separate the text into 4 different varchars to no avail.. none of the string functions (left, substring, right) works on a text field, and when i try to convert it to a varchar (i.e. convert(varchar(8000), @text)) it obviously only takes the first 8000 characters...
what can i do in this case? any help would be appreciated! thanks in advance!
View 2 Replies
View Related