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

Excel Multi Value Parameter fails

I have a stored proc that i pas through multiple values to one parameter. In SSMS this works perfectly. From excel i have a range of ids that i put into one cell as csv's. If i put 21 ids this works...

View Article


If exists update table (still errors)

I'm trying the following code to update a column.  My need is that it will not error, so I can run 200 of these at one time.IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME =...

View Article


BULK INSERT - COMMA DELIMITED FILE TO SQL SERVER FAILS ON ROW TERMINATOR

I am attempting to import a comma delimited text file into sql server using the bulk insert scriptBULKINSERTCSVTestFROM'c:\csvtest.txt'WITH(FIELDTERMINATOR=',',ROWTERMINATOR='\n') However the row...

View Article

Use CASE in HAVING clause

I feel like this should be simple but it I'm just not grasping it. Say I have this query:SELECT order_number, order_date FROM ordersI basically want to pull any order from the last 24 hours.  Well this...

View Article

sql server 2012 t-sql

Create Table Student_Grades ( StudentID Int ,FirstName Varchar(100) ,Course Varchar(100) ,Score Int ) -- Insert Rows in a Table Student_Grades Insert Student_Grades Select 1,'Rama','DSP',100 Union...

View Article


Recursivel​y Fetch the Records in SQL Server using Functions

Hi Team,I have the source table with two columns as in Point 1 and if the user writes the query for ex -330335 Risk ID, we need to get all the related Risk Id's as in the Target Table.The query should...

View Article

Schema design for a geocoding table in SQL Server

I'm thinking to cache a list of addresses and their coordinates (lat + long) in SQL Server. Usually I get the coordinates by invoking a web service and in order to avoid a round trip to that WS I want...

View Article

Updating column using another column from same table

Hi,Hi,I have following tableCol1| Col2 | Col3A     | q100 | nullB     | r200 | nullA    |  z500 | nullD    |  j700 |  nullB    |  n400 | null I want result as following tableCol1| Col2 | Col3A     |...

View Article


sql join

HI,How to join these two statement on TripId. you don't need to  understand the query .statement 1----------------------------------------------SELECT   tblTrips.TripId,tblTrips.DestinationDistrictId,...

View Article


Image may be NSFW.
Clik here to view.

Count Records in Table Except If Related Record Exists in Child Table

Dear AllI have the following query that counts all of the records in the table SENAlert based upon the teacher's username in a related table.SELECT COUNT(SENAlert.SENAlertID) AS Expr1 FROM Class INNER...

View Article

30,60,90 Days Totals in sql query

Hi All, Here I  have written a query to find the total for 30Days to calculate costs.... These 30Days Amount will be populated into another table based on joins. I know we can do by case in the final...

View Article

Error: The statement terminated. The maximum recursion 100 has been exhausted...

Team,I am getting the below error when I fired query in the database.ErrorThe statement terminated. The maximum recursion 100 has been exhausted before statement completion.QueryDECLARE @RiskID...

View Article

How to schedule auto generate report everyday and then csv file should be...

Hi AllHow to schedule auto generate report everyday and then csv file should be attach to office email recipient ? for that i want to create SSIS Package. I'm new to SSIS pacake pls help me how to do...

View Article


Customer Attrition Query

Hi all, I'm hoping someone can suggest the best approach to my issue. I'm trying to write a query to analyse the retention of customer purchases for each given month. So given a simple purchase order...

View Article

sql query

An expression of non-boolean type specified in a context where a condition is expected, near 'Name'.Description: An unhandled exception occurred during the execution of the current web request. Please...

View Article


Image may be NSFW.
Clik here to view.

The time has come! Step up T-SQL Gurus! Your community needs heroes like you!

TechNet Gurus... we salute you!You're awesome, and we know it!Your knowledge uploads and nifty info nuggets are our life blood at TechNet Wiki.Every awesome article that gets an award is just the...

View Article

how can i work with getdate() in my query if i have a varchar datatype on...

Hi All,I have a column like lastdate with varchar datatype. now I want to work with lastdate column in where clause with getdate().Ex:  wheregetdate()  -  lastdate < 1when I use above one I got...

View Article


The target is not in the current database

Can someone please help me with the following error? I am trying to create a trigger that copies data from a table in one database to another. However I am getting the error 'Cannot create trigger on...

View Article

Problem : Cannot resolve the collation conflict between ...

HiI want select a column from another database base on my current field on current database.here is my query :select ms.ServiceID, ms.ServiceName, ms.CoefficientFixedService, (select Services_Name from...

View Article

Dynamic queries / value in stored procedure risks of sql injection?

Trying to understand dynamic query / value in stored procedure. Can someone direct me to a good article that explains how sql injection / other potential risks are possible in stored procedures.For...

View Article
Browsing all 23857 articles
Browse latest View live


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