Forum Replies Created

Viewing 15 posts - 7,786 through 7,800 (of 13,460 total)

  • RE: Iterating trough a recordset, with a unknown nr. columns / and a identifier that is non sequential (1,2,3,4..)

    but the results is always a single column FOR XML isn't it? it doesn't matter if the XML contains multiple nodes or not.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Date - without the time

    you can also strip the time portion off of the parameter so you can compare dates to dates:

    Select DateID FROM tblDates WHERE theDate = select DATEADD(dd, DATEDIFF(dd,0,@SomeDate), 0)

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Iterating trough a recordset, with a unknown nr. columns / and a identifier that is non sequential (1,2,3,4..)

    but you do know the names and number:

    SELECT CustId AS label1, Name AS label2,Emailadres AS label3 FROM Customer

    into #tmp WHERE 1=2 FOR XML RAW

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Script that talks to multiple DBs cant be put into a SP

    for crossdatabase stuff inside a procedure , you only got two choices;

    1: can you adapt the specific script to use 3 part names?

    you know, SELECT * FROM Production.dbo.Invoices

    or

    2: switch...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Need to convert Column data

    i think this will do what you are asking:

    UPDATE loc_test

    SET assoc = CASE

    WHEN assoc = '1'

    ...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: script to Identify and revoke Public access on SP’s

    I had that same problem; someone used some script that granted all objects to the public role via a cursor that was included as some 3rd party app; yuck. some...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Replace string by character from another table

    here's some sample data i slapped together:

    with myERPMap(Letter,Code)

    AS

    (

    SELECT N'ü','\123' UNION ALL

    SELECT N'á','\111' UNION ALL

    SELECT N'é','\133'

    ),

    MyDataToFix (ThePhrase)

    AS

    (

    SELECT 'Personn\133l \123s\111g\133' UNION ALL

    SELECT 'sp\133ci\111l ch\111r\111ct\133rs' UNION ALL

    SELECT '\111lph\111n\123m\133ric cod\133'

    )

    so far, i've only...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Generate records based on field value in DB table's records

    i forced your data to be integers so i could perform math on them, like adding a year; then used a Tally table to generate the results:

    With MyData ([Customer...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Query building.

    two typical methods can be used

    select distinct user from yourtable

    --or

    select user from yourtable group by user

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Can you use Express Edition client tools to connect?

    you'll have to install the tools from the standard edition;

    the express tools will only let you connect to the database engine.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Is possible to know who is using tempdb?

    in answer to my own question, i think i needed to use dm_db_session_space_usage instead; that gives me 600 KBbytesUsed in my example.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Is possible to know who is using tempdb?

    Eddie thanks for the pointers...I'm not getting the results I'm expecting, though.

    I created a temp table with the typical SELECT * into #tmp fromSomeTable.

    then i ran this command to see...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Joining to a lookup table using calculated field based on CASE statement

    why can't you just wrap the big query as a subselect or CTE, and then join to your lookup table:

    you know,

    Select

    MyAlias.*,

    RK_tblInjCodes.*

    FROM (

    --big query goes...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Changing SPROC removes Role From Database

    could it be something like a missing GO statement, so the DROP/CREATE rolename is part of some stored proc that gets executed?

    CREATE PROC MyProc

    AS

    SELECT 1 from sys.objects

    --missing GO

    If Exists(somerole)

    drop role...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Using IDENTITY or handling it your own?

    identity is still exactly what you want, even if you are combining multiple databases together, in my opinion.

    One way is to use ranges for the seeds for the identities...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 15 posts - 7,786 through 7,800 (of 13,460 total)