Looping Rows in SQL Server
I have a SQL Server table with 2 columns, Code and CodeDesc. I want to use T-SQL to loop through the rows and print each character of CodeDesc. How to do it? ...
I have a SQL Server table with 2 columns, Code and CodeDesc. I want to use T-SQL to loop through the rows and print each character of CodeDesc. How to do it? ...
hi, if i apply a sql query statement to this table "select * from context.tablename", all i see is the "Executing query.." message and nothing else hapens. I also can not truncate or drop this table. It prevents me from even dropping vhole database. Is it possible, that this problem is caused by inserted data into this table??? I'm usi...
I have a login page on which are userid and password feeld, but I want to write the query for login when user can give username or emailid in userid textbox. ...
Now that we've ran out of int capacity on a PK column (which is an IDENTITY) I'd like to do this to bigint, but simple ALTER TABLE seems to be unable to handle that big of a table. So my question is: how do I change the type of a PK column with keeping actual values in place and do I need to alter referencing tables as well? ...
I am using multiple IN operators with AND in my sql query where clause as given below... --- where ID in (1, 3, 234, 2332, 2123, 989) AND tag in ('wow', 'wonderful') But surprisingly behaviour of result seems to be of OR type rather then AND type. What I mean is it is ignoring AND operator... Can you please explain me why? ...
in my application user can give username or emailid to login how can i write the query like select username,password from employee where username='xxxx' or '[email protected]' and password='******' how can i write the query so that user can give username or emailid to login. please send query for this problem thank u ...
I'm trying to copy the results from a view to a table using: insert into tableA select * from viewB order by id; I get the error message - Msg 241, Level 16, State 1, Line 1 Conversion failed when converting datetime from character string. TableA and ViewB have about 80 fields. Trying to figure out which one's might have a type ...
I want to display the time like mr.xxx login 1 minit ago or 1 hor ago or 2 days ago or 1 month ago or 1year ago. how can i write the query to display like that [for example in our stackoverflow we see mr.xx joined 5 days ago. he ask question 2 minits ago] please help me ...
Hello! I'm implementing a web - based application using silverlight with an SQL Server DB on the back end for all the data that the application will display. I want to ensure that the application can be easily scalable and I feel the direction to go in with this is to make the database loosely coupled and not to tie everything up with f...
I want to extract a subset of a database and copy to another server/database. Is it possible to copy/backup a single filegroup from one database and attach/restore to another? ...
Hi, I'm working on a employee booking application. I've got two different entities Projects and Users that are both assigned a variable number of Skills. I've got a Skills table with the various skills (columns: id, name) I register the user skills in a table called UserSkills (with two foreign key columns: fk_user and fk_skill) I reg...
I've got a trigger in a sql server table. This trigger has disappeared. Is there something systematic that might be causing it to be deleted? There is no replication on this db. ...
I have an ETL process performance problem. I have a table with 4+ billion rows in it. Structure is: id bigint identity(1,1) raw_url varchar(2000) not null md5hash char(32) not null job_control_number int not null Clustered unique index on the id and non clustered unique index on md5hash SQL Server 2008 Enterprise Page level compr...
I've got a database View in SQL Server 2008 and when I run it from Query Analyser, it runs within a couple of seconds. When I run it in Excel 2007, it loads the data just fine. But when I run it in Word 2007 on a mail merge, it just seems to take a very long time to run (literally minutes to run). If anyone has an idea how to solve this...
While validation can prevent most SQL errors, there are situations that simply cannot be prevented. I can think of two of them: uniqueness of some column and wrong foreign key: validation cannot be effective as the an object can be created or deleted by other parties just after validation and before db insertion. So there are (at least) ...
In SQL Server, the following works: sp_help MyProc sp_depends MyTable But if you include the owner, it fails with a syntax error: sp_help dbo.MyProc sp_depends dbo.MyTable It makes you put the param in quotes for it to work. Yet, I could do the following no problem: exec dbo.MyProc Why the inconsistency? Is there a reason? ...
I am building a table for tracking the history of particular objects in my database. Currently I have following columns: HistoryId int IDENTITY(1,1) NOT NULL HistoryDate datetimeoffset(7) NOT NULL HistoryTypeId int NOT NULL HistoryDetails nvarchar(max) NULL For the most part each history item will be self-explanatory through the His...
I'd like to save data from a SQL Server database table to a file, then load it into another database that has the same table already created in it How can I do this? I know there should be some simple way of doing it, but stackoverflowsearch and google aren't yielding good answers (or I'm not asking a good question). ...
Data from another system is replicated into a SQL Server 2005 database in real-time (during the day, it's hundreds of transactions/second) using Goldengate. I'd like to be able to tell if there's been a transaction recently, which will tell me if replication is currently happening. Even in the off-hours, I can expect a transaction every ...
If I have some xml: <Users> <User> <property1>sdfd</property1> ... <User> ... </Users> And my sql is: SELECT * FROM OpenXML(@idoc, '/Users/User') WITH ( [property1] varchar(50) 'property1', ... ) How can I get the name of the parent element and return that in the d...