Hi,
The sql below creates a temporary table that populates numeric ranges, basically I can define a numeric range i.e. 0 to 200 and the number of splits i.e. 4, the query then splits the range into 4 intervals.
The split column is my split id, so I know which is the 1st, 2nd, 3rd interval and...
Hi,
I have a piece of sql that composites data to a specified interval (@compositeby).
If I want to composite the data in the table by a float value (not an integer) then I get an error.
In the code below the @compositeby is set as 2.5, but it gives me an error:
Msg 245, Level 16, State 1...
Hi,
I am using SQL Server 2005, I would like to know the best way to dynamically pivot data from a table using a table valued function.
In the code below I have an ID, TYPE, SerialNumber and SEQ column, I would like to pivot the data to give the following example:
ID 4145_1 4143_1...
Hi,
I have a normalised table called RESULTS, which contains water values.
I would like to pivot the values so there is a column for each type. I am able to do this with sql below and the result is:
ID Water_1 Water_2 Water_3
1A 0.01 0.01 0.01
1A 0.013...
Hi,
I would like to know how to amalgamate interval data using t-sql. The code below creates a temp table and I would like a query to amalgamate the intervals grouping by the field CODE,
I can use the sql
select id,min(INVFROM),max(INVto),code from #temptable group by id,code
but this...
Hi,
I want to copy files from an array to a destination folder, I also want to check the date as well.
I tried the following script and get an error: Expected end of statement
Dim FilesToCopy As String
Dim sCopy() As String
Dim i As Integer
FilesToCopy =...
I would like some help with the following query.
The sql is designed to subtract 1 from the aplhanumeric value in the column ID and show the result in column [PREV_ID]
The combination of numeric and non-numeric characters can vary.
For example the prefix can vary like:
BD001
or
1234/01c...
Hi there,
The code below creates a table of data called ORIGTABLE, this table has a id column called ORIGID, that increments by 1, for example 'ID1_001','ID1_002 and so on.
I have another table called TESTTABLE, which contains an id column called TESTID.
The idea is that the user selects a...
Hi,
Is it possible to have sql return a comma separated list (string) of file names that exist in a folder.
This can be done using a batch command script or VBScript, it will be return the file names in a specified folder, but how do I incorporate this into an sql statement or sql sp.
Thank you
Hi there,
I am getting the following error when casting the date '24/08/2007 10:40:00' in the sql below:
select cast('07/04/2009 14:57:00' as DATETIME)
ok
select cast('24/08/2007 10:40:00' as DATETIME)
The conversion of a char data type to a datetime data type resulted in an out-of-range...
Hi,
This relates to thread thread183-1496513 which I am revisiting and need some more help with sql:
In the following code example I have a table of TEST id's that I want to composite into 3, so 1 composite is a combination of 3 test id's, this works fine. When I add the TYPE column to the...
Hi,
Is there a mathematical function or code in sql that will work out if a value is a multiple of 3. In my database a value entered into a column in my table can only increment by 3, so 3, 6, 9, 12.... is ok, 1,2,4,5,7....not ok
is there way of checking a value using a function.
Thank you
Hi,
This question relates to question: thread183-1545958
I have a dynamis sql statement that returns a view of results. I'd like to use the same statement in a table function, which I can pass the variable @type into.
When I constructed the function I recieved the error :
"An INSERT statement...
Hi,
I am using sql 2005.
I would like some help with select data from 3 normalised tables, but dynamically.
I have 3 tables HEADER, RESULT and TYPE. The TYPE table is like a reference table for the NAME field in RESULT.
I want to select the results from the HEADER and RESULT tables but pivot...
Hi,
It'd be appreciated if you could let me know if it's possible to be able to set the SQL authentication to be able to prompt users to change their password as in windows authentication, every 90 days.
Thank you
Hi,
I would like to split the values in a string:
if I have a string 'ab+cfr+ddf'
select 'ab+cfr+ddf'
and I would like a column:
ab
cfr
ddf
or be able to select the 1st code 'ab' or the 2nd 'cfr' or 3rd 'ddf' using sql.
Thank you
Hi there,
I am trying to generate some dynamic sql to print sql statements that can be copied and used to insert data into a table.
Below is some sql that first creates a temp table, then a procedure to generate the insert statements and the usage.
--TEMP TABLE
CREATE TABLE...
Hi,
I am trying to convert values from the ROWID column in a table to a comma delimited list, like:
2,4,6,8,10
I am using a function, which used the ROW_NUMBER() function and keep getting the error:
Error converting data type varchar to bigint
Here is the code:
CREATE TABLE...
Hi,
I am trying to write a query to return every nth record i.e. every 20th
I am using the sql:
select * from TABLE
where RIGHT(ID,4) % 20 = 0
and ID like 'TEST%'
where the ID is like 'TEST0001' and so on. I have 100 records for example but if returning every 20th record I'd expect my...
Hi,
I would like some help with some sql I am trying to develop to UNPIVOT a flat table, and normalise the data.
AT_TEMP is the flat table, I am using the UNPIVOT fuctionality in sql but with unions to get the results, I'd like to know how to make it more dynamic so I don't have to use unions...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.