Copy a table from Server to my local computer
Hi!Suppose I create a permanent table called "Customer" in Server using MSMS: USE MyServer Create Table CUSTOMER ( field1 nvarchar, ..etc... )(a) Exactly where is this table...
View Articleupdate one table from another when the column names match
declare @people table( avatarkey varchar(36) not null primary key, avatarname varchar(50), prims int, allotment int, lockers int ) --lots of code to fill table update @people set prims=(select prims...
View ArticleWhat is the Equivalent of SCOPE_IDENTITY for SEQUENCE object?
The OUTPUT clause can be used. Is there any other choice? Thanks.CREATE SEQUENCE dbo.NextCustomerID as BIGINT START WITH 1 INCREMENT BY 1; GO -- Get the next available ID CREATE TABLE Customer(...
View ArticlePartition Table with Data in Place
I think that I have successfully partitioned a 125 GB database with the data in place but I would like confirmation that my thinking is correct. The partition field happens to be the first field in the...
View ArticleFind string with hyphen usng t-sql
Hi,I have a requirements to find string with a hyphen like -RTR but the codes below there are some string that did not give the result specially the 5th records on my sample data. May i ask your...
View ArticleSQL server 2005 TSQL problem
Deal all\,Table1 Table2 T1Col1T1col2T2Col1T2col21asdf1asdf2ghgh2ghgh3kkjk3kkjk4kkjk4ldflkl5jhjj5urwsThink that i have above 2 tables in SQL server 2005.select * from table1 where T1Col1 in ( select...
View ArticleBlocks within Try catch Block
I am pretty sure i know the answer to this but before giving up on using Try Catch I would like verification.The MSDN article on Try Catch states:A TRY…CATCH construct cannot span multiple batches. A...
View Articleconverting old-style joins
-- Hi All, post-upgrade I need to re-write some old-style joins from sql2000 (sp3). -- But query1 (below) returns 225 rows whilst query2 only returns 15. Any help please?select station,type,count(stn)...
View ArticleSQL group by query to return more than just group by columns
Hi. I have a table similar to this where MyUID is unique. I need to locate rows which are unique on the last 3 columns and then pick the row with the most recent DateTime. So the result of the query is...
View ArticleSimple math UDF hangs
Seeing some odd behavior. I know that UDFs are generally not a good development approach however in this case we are using them appropriately. They contain only math functions, are expected to be...
View ArticleSQL server Newbie question about specific trigger implementation
I have a table called K2K01.dbo.custand another called K2KConceptActions.dbo.Actions(different database, same server)The K2K01.dbo.cust table is part of an ERP system.The K2KConceptActions.dbo.Actions...
View Articlehow to manage the following scenario?
hi to all...i have to save data for customers and vehicles in a web project...1- suppose a customer walks in with a vehicle 2- the operator asks the customer his/her name and vehicle numberand then the...
View ArticleRunning total based on time
Hi,Can someone help me how to get the running total based on the time, I have requirement where I need to calculate the running total of each ip for a certain period of time until the users leaves that...
View ArticleA chance for YOU to play for the T-SQL team, in the TechNet Guru World Cup!
The World Cup is here again!Not balls... brains!And YOU have been selected to play on our team!Yes forum reader, step up and take a shot!Slam some techie tips in the back of our nets!No dribbling...
View ArticleHow can i sum the columns by condition?
ID Type QTY1 A 202 A 203 B 20I want to some QTY group by A but I also need the ID column to identify the order of row.How can I sum QTY group by A and the...
View ArticleOracle to TSQL binding variables
I've done a lot of searches and I just can't figure it out. What is the TSQL (from Oracle) equivalent for the colon here:select ID, GRADE from TGroups WHERE ID= substring(:NAME,1,5)
View ArticleValue from other dataset returned value
I have a report with two datasets. One dataset gives the values (names) for a dropdown list. The other dataset takes that name chosen from the dropdown list to create the rest (a graph) of the report....
View ArticlePostcode separation from address into 2 columns
Hello guys, can anyone please help me separate postcodes from a table that has Address & Postcode all in one column? I need to separate the postcodes from the address in every row, we're talking...
View ArticleOVER FUNCTION
Hi all, I need some help. I've been spending the last few hours trying to resolve an issue I'm having when using the OVER function in SQL. I'm trying to create a rolling moving average (in my case 30...
View ArticleCorrelated inline view?
I have a need to correlate an inline view with the primary table in a query.Essentially I am trying to flatten out some rows of data into columns. I've got it working on a limited basis but it...
View Article