Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

sql_variant data are truncated

I try to create a new table ‘Table_1’ in SQL Server 2008 and add a field ‘f1’ of type sql_variant, then try to invoke the following SQL statement to insert a value to ‘f1’, as follows:Insert into...

View Article


error message AFTER enabling service broker

Hi Experts, I'm trying to set up database mail and having an issue.  I'm using a script that's worked before, but it's not working in this particular instance so I'm stumped.When I try to send an...

View Article


Users have multiple records. Query for specific records.

I posted this in the SQL Server Reporting Services forum, but somebody suggested trying here, so I am posting here as well.I have Visual Studio 2008. I use it in creating BIDS reports that are then...

View Article

Syntax Error - Order

I am trying to merge output from 3 selection processes. Here is the code that I am using and then I will show the error that I am receiving when trying to execute.select...

View Article

Getting last Saturday from a given date

Experts,How can I find the date of the last Saturday from a given date?Say if I give you 03/11/2014, how can I find the date of the Saturday before the day given(03/11/2014)?Regards,ebro

View Article


Bulk INsert with variable Lastrow

I just cam across this.http://dbaspot.com/sqlserver-programming/416932-bulk-insert-lastrow-attribute.htmlHow can I incorporate that into this SQL Script?DECLARE @fullpath3 NVARCHAR(2000); DECLARE...

View Article

DROP table if exists in different database in the proc

hi ,         I tried searching,but i couldnt get sql code my questions is.   suppose a procedure  is running on x database the tables inside belong to y database.I need a syntax for that  tables which...

View Article

remove .00 from string while conversion

How do i remove .00, .01 from the string while converting that string to inti tried to do this Select REPLACE(CONVERT(varchar(15), [Cases], 1), '.00', '') from table UPDATE table SET [CASES_d] =...

View Article


Multiple accesses to a table

Hi all,  I'm looking for practical examples on how to solve a problem of concurrent accesses in the following scenario.  I have N clients accessing the same table and performing the sequence of...

View Article


How to create a view on SQLServer 2008 as an OPENQuery select to a MYSQL...

I am trying to create a view on SQLServer through Management Studio based on data on a MYSql server.I have created the Linked server and I am able to query all data.Using the syntax select * from...

View Article

Lock a table without using the primary key

Hi,I am trying to update a table, for example product table,product (idint (identity),product_codenvarchar(50),descriptionnvarchar(128) )the primary key is product_code, during updating the table, I...

View Article

Bulk insert of text file Help PLEASE!

Hello,I am trying to insert the following data into a sql server table.11470012 31020141100AMFI2              TENTATIVE APPOINTMENT SET FOR 03/17/2014 AT 10:00 AM 11470012 31720141000AMFI7...

View Article

Need optimized T-SQL query

Hello,I have a requirement where a table has ItemId & AuthenticationString (default to replicate('0',8000)) and other table has ItemId & CodeNumber. If in second table there exists a CodeNumber...

View Article


SQL SERVER 2008 Finding missing months between 2 dates

Hi, I have 2 tables. create table #Policies (idno int, startdate datetime,endDate datetime) insert into #Policies (idno,startdate,enddate) values ( '1094567','2005-11-20','2008-04-30') create table...

View Article

CELKO vs. TOTH in SS T-SQL Table Design

The designs, based on minimal & incomplete information, are from the following...

View Article


how to have two while loop

there is only one @@FETCH_STATUSOPEN Buy_Record_Cursor; OPEN Sell_Record_Cursor; FETCH NEXT FROM Buy_Record_Cursor; FETCH NEXT FROM Sell_Record_Cursor; WHILE @@FETCH_STATUS = 0 BEGIN WHILE...

View Article

Trigger is not working on multi row insert

Hello Guys,I have created below trigger, it is working fine if we insert 1 row but the  problem is if we insert multiple rows into the table it is processing only one's.What is the correct way to...

View Article


Help needed for solving interesting problem

Hi friends,This is my scenario:We have a table with 980+ columns. For each transaction entered not all columns will contain data, Most of the time for each row there will be having data only in few...

View Article

Query help with distinct

Hi All,I wrote this query to pull the data.       Select [custid]          ,[firstname]      ,[lastname]      ,[addrline1]      ,[addrline2]      ,[city]      ,[zip]      ,[stateid]      ,[secphone]...

View Article

Filter position

I have some derived table with many select statements inside:SELECT Tk.productID, Tk.Q, Tk.col1 FROM ( SELECT productID, Q, col1 from tbl1 where .... UNION ALL SELECT productID, Q, col1 from tbl2 where...

View Article
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>