I have developed my own word breaker for SQL 2005 and the Full Text Search feature. I know how to use it by simply hijacking an existing language and add the wordbreaker to the registry for the hijacked language. However I'm not completely satisfied with that solution. I want to create a completely new language is this possible?
hi!
Is there a way to insert only date in a datetime column in sql server without the time?
for example
date (datetime)
===============
12-01-2000
16-02-2000
or i should store this as a varchar and cast it when retriving so that i can convert to whatever form i need.
I want to be able to perform a IF...THEN in an SQL SELECT Statement.
For Example;
SELECT IF(Obsolete = 'N' or InStock = 'Y';1;0) as Salable, * FROM Product
Is there an method for programatically (in T-SQL) retrieving the maximum (and minimum) value of a datatype? That it would act like float.MaxValue in C#.
I would like to use it in some selection when the parameter does not equal any actual values in the database, so I would use something like
declare @min float
declare @max float
/*fill @min and @max, can be null if undefined*/
select * from foo
where bar between isnull(@min,0 ), isnull(@max,max(float)/*magic*/)
Thanks
Hi,
I just noticed that if I have an identity column in a table, when I insert new rows SQL Server 2008 is automatically filling up the sequence if there are discontinuity. I mean, if in my identity column I have 1,2,5,6 if I insert other two rows in the table the system puts automatically 3,7 in the identity column.
Do you know how to control this behavior?
THANKS
Hi Experts,
I am using sql server 2005
I have a table [say tblHistory] and this table contains 100 rows.
I have created the same table at the server, but the table doesn't have the data, I want data from tblHistory to convert into
INSERT INTO tblHistory ------
so that I could run the script on the server to fill the database.
Please help, it's urgent
Question: The new SQL Server 2008 database returns me values formatted English (date/float).
Is there a way I can set the return format ?
For example temporarely switching the database language?
Or just set the language for the current query ?
Sql server 2005 (even 2008) strips the insignificant whitespaces by default. To keep one can use the CONVERT funtction with the last argument as '1' (Ref. Article). How can we do the same thing in Entity Framework?
thanks
In sql server 2008, i have taken Full backup type of my database and database was successfully done.My question is while restoring it how can i check or know that my whole backup was perfect ?
I need to find the path of the database (MDF) or at least the database logs loaded but for some reasons I cannot login through the SQL Server so I need to know if you know any file/config file that keeps the path of the databases or log file .
Hi there,
I am trying to write a sql statement that
I have 2 tables Store & StoreTransactions.
My first select command looks like
SELECT [StoreID],[ParentStoreID]
FROM Store
Very simple stuff. How do I take the returned StoreID's and use them for my 2nd select statement?
SELECT [StoreTransactionID],[TransactionDate],[StoreID]
FROM StoreTransactions
WHERE StoreID = returned values from the above query
Any help would be great!
Are there any updates in SQL 2008 to allow a variable for the IN of a where clause?
Declare @InParams varchar(100)
Set @InParams = '1,2'
Select * from Category
Where CategoryID in @InParams
I recently encountered a problem in my production database due to MySQL bug. The bug is in the TimeStamp column. To avoid any inconvenience, I want to migrate the database to either Sql Server.
Is there any FREE tool to easily and reliably migrate data and table structures?
When get a .sql file, how do you execute it? Double click to open it and press F5? Is there any other way to execute it and also able to see the execution result. Thanks.
I have a column which is integer and I want to search all numbers starting with 1500. I know I could use something like left(accountid,4)= 1500. But is that an optimum solution or is there a better approach? I am using Sql Server 2005.
Is there anyway to do this in SQL Server 2005?
declare @tv_tablelist table (recnum int identity(1,1) primary key, newvar varchar(500))
declare @mysql nvarchar(4000)
set @mysql = 'insert into @tv_tablelist(newvar) values (''test test test'')'
Exec sp_executesql @mysql,
N'@tv_tablelist table (recnum int identity(1,1) primary key, newvar varchar(500)) OUTPUT',
@tv_tablelist OUTPUT
select * from @tv_tablelist
select @[email protected]('*')
for xml raw,type
Above statement will generate following alert:
Msg 6819, Level 16, State 3, Line 2
The FOR XML clause is not allowed in a ASSIGNMENT statement.
Consider the following MS SQL Server table:
ID | X | Y
------+-------+-------
1 | 1 | 1
2 | 1 | 2
3 | 1 | 3
4 | 2 | 40
5 | 2 | 500
6 | 3 | 1
7 | 3 | 100
8 | 3 | 10
I need to select the ID of the row that has the maximum value of Y grouped by x, i.e:
ID | X | Y
------+-------+-------
3 | 1 | 3
5 | 2 | 500
7 | 3 | 100
The query will be nested several times so an optimal performance solution is required...
Thank you!
I am trying to convert rows into columns. here is my query
SELECT M.urn,
M.eventdate,
M.eventlocation,
M.eventroom,
M.eventbed,
N.time
FROM admpatevents M
INNER JOIN admpattransferindex N
ON M.urn = N.urn
AND M.eventseqno = N.eventseqno
AND M.eventdate = N.eventdate
WHERE M.urn = 'F1002754364'
AND M.eventcode = 'TFRADMIN'
Current result
URN Date Location Room Bed Time
F1002754364 20121101 EDEXPRESS 4-152 02 0724
F1002754364 20121101 CARDSURG 3-110 02 1455
F1002754364 20121102 CHEST UNIT 6-129-GL04 1757
required result
F1002754364 20121101 EDEXPRESS 4-152 02 0724 20121101 CARDSURG 3-110 02 1455 20121102 CHEST UNIT 6-129-GL 04 1757
Thanks for your help.
hi,
I need to extract data from my SQL Server database into multiple text files.
I have a table with 4 columns: UserID, UserName, Tag, Score.
I need to create a text file for each Tag (so basically I need to group by Tag and order by score).
Before to start I would like to know what's the fastest way to create several text files:
File titles = TAG field
each line = userID
I want to use case in sql statement where clause but I have a problem as I want to create a where clause condition on the basis of some value and I want to set a not in clause values on the basis of it
here is the query where am facing an issue
WHERE CODE = 'x' and
ID not in (
case
when 'app'='A' then '570','592'
when 'Q' then ID 592,90
else 592,90
END
but its not syntax
I am reading though the sql server 2008 bible and I am covering the views section. But he really dont explain the purpose of views. What is a good use for views. Should I use them in my website and what are the benefits of them.