i am using if condition to find out a time
but problem is how can i put multiple condition in if like
if(time=="06 AM" and "08 AM" and "07 AM")
View Complete Post
It is possible to alter multiple columns within a single alter table statement?
I tried & searched not getting it.
Alter table au_de alter column m_user char(9),c_user char(9)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.
Alter table au_de alter column m_user char(9),alter column c_user char(9)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.
Here's my current SELECT statement:
SELECT u.Email FROM UserProfiles p, aspnet_Membership u WHERE p.RulesCheckBox = 'True' AND u.UserId = p.UserId
This gives me a list of registered member email addresses that have selected the RulesCheckBox in their profile, so I can email them with an email script. There is a relationship between the Membership table and the UserProfile table, so it finds the email addresses from the Membership table where that user has the RulesCheckBox checked in their profile (in UserProfiles table). I'm wanting to add some additional names to this list, from a different table. The purpose is so I can manually add email addresses to the additional table, so the additional email addresses will also receive the same email, even though they aren't registered members of the site.
So how can I adjust that SELECT statement so this one is combined with it somehow?:
SELECT Email FROM ExtraEmails WHERE Rules = 'true'
With SQL Server 2005 Express coming out, I have switched from MySql.ÃÂ I'm having trouble with a very simple INSERT statement that has previously worked in both MySql and Oracle.ÃÂ The statement is as follows:
INSERT INTO pantscolor_t (procode,color,pic) VALUESÃÂ ('74251', 'Black', '511black.jpg'),ÃÂ ('74251', 'Charcoal', '511charcoal.jpg'),ÃÂ ('74251', 'Khaki', '511khaki.jpg'),ÃÂ ('74251', 'Navy', '511navy.jpg'),ÃÂ ('74251', 'OD Green', '511odgreen.jpg');
However, when I attempt to execute this statement with Management Studio Express I get the following error:
Msg 102, Level 15, State 1, Line 2Incorrect syntax near ','.
declare @year int,@month int
while (@month <=13 and @year<=year(getdate()))
SET @year=case @month when 13 then @year +1
ans @month =1 else @year end
in this case statemtent i also want that when year increase means when increment of year happens then month variable shouls chage oe reset to 1 so that loop can start from 1 month of new year..
but i get error in this case statement when i use and @month =1
please help me and provide needful step
I have search input on my web page txtSearch.text(Column name is JobNO ,this column present in all the 3 tables), when i submit a value click on search button it has to read 3 tables.is it appropriate writing 3 queries in if condition..something like follows but not sure of it
if txtSearch.text<>"" thenQuery=select * from ship elseif txtSearch.text<>"" thenQuery=select * from openorderelseQuery=select * from scheduleend if
when i give above input it should read 3 tables and write the value on grid view,i am held up here and thankful to you can any one provide the possible solution
I would like to return a result set that has mutliple rows containing Date and Time stamps and a value but I only want the record set returned if one of the records has a Minimum value in it of 50. How would this be constructed so all the rows
are returned and not just the Value=50 row? I know GroupBy is probably used but am a sql novice.
1. select -----
from table1 t1 join table2 t2 on t1.a=t2.a
left join table3 t3 on t1.a=t3.b
2. select -----
left join table3 t3 on t2.a=t3.b
I'm not sure about the behavior of above 2 statements. What kind of result do i expect?
When should i use both kind of joins?
I have one Stored Procedure which returns some value. now i have some different conditions in my select query so can i write them in my where clause instead of writing the whole select query again for different conditions?
My Current Select Statement in SP looks like :
Now i have two more conditions in my Select Statement that are
and they gets the list of id of their name from another function that is made for them respectively fun_GetProductId and fun_GetStatusId
so with this my Select Statement in SP will look like
(UniqueRef='@UniqueRef' or @UniqueRef='') and
(Productid in (Select * From fun_GetProductId(@ProductList))) and
(StatusId in (Select * From fun_GetStatusId(@StatusList)))
any help on this would be great.
I basically have a series of tables from one database that have an identical structure thus making retrieval of all records fairly easy (I just use a UNION ALL statement). However I need a list of values from another table within a different database that contains information regarding the group of the data.
I so far have the following:
SELECT Table1.* FROM Table1 UNION ALL SELECT Table2.* FROM Table2 UNION ALL SELECT Table3.* FROM Table3 UNION SELECT Database.dbo.SRFILE.SR_GROUP FROM Database.dbo.SRFILE INNER JOIN Database.dbo.SRFILE.SRONUMBER = Table1.Incidentx
I keep receiving a unable to parse message however all I need to retreive is the SR_GROUP value but just don't know the correct syntax. Is it actually possible to do this as the structure of SRFILE is not the same as Table1/2/3.
When executing a large .sql file contents, which creates a lot of objects on a database, running the ExecuteNonQuery over a Database object, we're getting a FailedOperationException. Is there a way to find which of the SQL statements passed in
the string is causing the exception, and have some more 'familiar' error message?
Are there other options to run the multiple T-SQL statements created with the SQL Server Management Studio database script generation feature?
We are using the SMO on a .NET Fx 3.5 app running against a SQL Server 2008 instance on a 32 bits computer.
I have a customize listBox in which I am defining a DatatTemplete for that ListBox, the code is something like:
I have a table that has a date, amount of litres, price per litre. The table is updated every month, what I have been trying to do is display the total revenue for each year ( amount of litres * price per litre this will give me the revenue for
each month and then add each month together to return that years revenue) I can't seem to get this statement right, any tips?